Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…to add_random_state_arma
  • Loading branch information
QBatista committed Aug 26, 2017
2 parents 95f3efb + 5095334 commit 6706bb9
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 79 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ before_install:
#- sudo ln -s /run/shm /dev/shm

install:
- conda install --yes python=$TRAVIS_PYTHON_VERSION ipython numpy scipy matplotlib nose pandas pip sympy pytables statsmodels numba
- conda install --yes python=$TRAVIS_PYTHON_VERSION ipython numpy scipy nose pandas pip sympy pytables statsmodels numba
# To Install Full Anaconda Stack (conda install --yes python=$TRAVIS_PYTHON_VERSION anaconda)
- pip install coveralls coverage
- python setup.py install
- cp quantecon/tests/matplotlibrc .

script:
- nosetests --with-coverage --cover-package=quantecon --exclude=models #quantecon.models excluded from tests to prevent triggering the ImportWarning
Expand Down
2 changes: 0 additions & 2 deletions pip-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ numpydoc

scipy

matplotlib

pandas

statsmodels
Expand Down
67 changes: 0 additions & 67 deletions quantecon/arma.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"""
import numpy as np
from numpy import conj, pi
import matplotlib.pyplot as plt
from scipy.signal import dimpulse, freqz, dlsim
from .util import check_random_state

Expand Down Expand Up @@ -260,69 +259,3 @@ def simulation(self, ts_length=90, random_state=None):
vals = dlsim(sys, u)[1]

return vals.flatten()

def plot_impulse_response(self, ax=None, show=True):
if show:
fig, ax = plt.subplots()
ax.set_title('Impulse response')
yi = self.impulse_response()
ax.stem(list(range(len(yi))), yi)
ax.set_xlim(xmin=(-0.5))
ax.set_ylim(min(yi)-0.1, max(yi)+0.1)
ax.set_xlabel('time')
ax.set_ylabel('response')
if show:
plt.show()

def plot_spectral_density(self, ax=None, show=True):
if show:
fig, ax = plt.subplots()
ax.set_title('Spectral density')
w, spect = self.spectral_density(two_pi=False)
ax.semilogy(w, spect)
ax.set_xlim(0, pi)
ax.set_ylim(0, np.max(spect))
ax.set_xlabel('frequency')
ax.set_ylabel('spectrum')
if show:
plt.show()

def plot_autocovariance(self, ax=None, show=True):
if show:
fig, ax = plt.subplots()
ax.set_title('Autocovariance')
acov = self.autocovariance()
ax.stem(list(range(len(acov))), acov)
ax.set_xlim(-0.5, len(acov) - 0.5)
ax.set_xlabel('time')
ax.set_ylabel('autocovariance')
if show:
plt.show()

def plot_simulation(self, ax=None, show=True):
if show:
fig, ax = plt.subplots()
ax.set_title('Sample path')
x_out = self.simulation()
ax.plot(x_out)
ax.set_xlabel('time')
ax.set_ylabel('state space')
if show:
plt.show()

def quad_plot(self):
"""
Plots the impulse response, spectral_density, autocovariance,
and one realization of the process.
"""
num_rows, num_cols = 2, 2
fig, axes = plt.subplots(num_rows, num_cols, figsize=(12, 8))
plt.subplots_adjust(hspace=0.4)
plot_functions = [self.plot_impulse_response,
self.plot_spectral_density,
self.plot_autocovariance,
self.plot_simulation]
for plot_func, ax in zip(plot_functions, axes.flatten()):
plot_func(ax, show=False)
plt.show()
2 changes: 0 additions & 2 deletions quantecon/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ requirements:
# - numpy
# - scipy
# - pandas
# - matplotlib

run:
- python
- numpy
- scipy
- pandas
- matplotlib

test:
# Python imports
Expand Down
2 changes: 0 additions & 2 deletions quantecon/tests/matplotlibrc

This file was deleted.

8 changes: 5 additions & 3 deletions quantecon/util/tests/test_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Authors: Pablo Winant
Tests for timing.py
"""
from numpy.testing import assert_allclose


def test_tic_tac_toc():

Expand All @@ -22,9 +24,9 @@ def test_tic_tac_toc():
time.sleep(h)
el3 = toc()

assert(abs(el1-h)<0.01)
assert(abs(el2-h)<0.01)
assert(abs(el3-h*3)<0.01)
rtol = 0.1
for actual, desired in zip([el1, el2, el3], [h, h, h*3]):
assert_allclose(actual, desired, rtol=rtol)


if __name__ == "__main__":
Expand Down
1 change: 0 additions & 1 deletion rtd-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies:
- numpy
- numpydoc
- scipy
- matplotlib
- pandas
- statsmodels
- sympy
Expand Down

0 comments on commit 6706bb9

Please sign in to comment.