Skip to content

Commit 6706bb9

Browse files
committed
Merge branch 'master' of https://github.com/QuantEcon/QuantEcon.py into add_random_state_arma
2 parents 95f3efb + 5095334 commit 6706bb9

File tree

7 files changed

+6
-79
lines changed

7 files changed

+6
-79
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ before_install:
2525
#- sudo ln -s /run/shm /dev/shm
2626

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

3433
script:
3534
- nosetests --with-coverage --cover-package=quantecon --exclude=models #quantecon.models excluded from tests to prevent triggering the ImportWarning

pip-requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ numpydoc
1010

1111
scipy
1212

13-
matplotlib
14-
1513
pandas
1614

1715
statsmodels

quantecon/arma.py

-67
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"""
1010
import numpy as np
1111
from numpy import conj, pi
12-
import matplotlib.pyplot as plt
1312
from scipy.signal import dimpulse, freqz, dlsim
1413
from .util import check_random_state
1514

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

262261
return vals.flatten()
263-
264-
def plot_impulse_response(self, ax=None, show=True):
265-
if show:
266-
fig, ax = plt.subplots()
267-
ax.set_title('Impulse response')
268-
yi = self.impulse_response()
269-
ax.stem(list(range(len(yi))), yi)
270-
ax.set_xlim(xmin=(-0.5))
271-
ax.set_ylim(min(yi)-0.1, max(yi)+0.1)
272-
ax.set_xlabel('time')
273-
ax.set_ylabel('response')
274-
if show:
275-
plt.show()
276-
277-
def plot_spectral_density(self, ax=None, show=True):
278-
if show:
279-
fig, ax = plt.subplots()
280-
ax.set_title('Spectral density')
281-
w, spect = self.spectral_density(two_pi=False)
282-
ax.semilogy(w, spect)
283-
ax.set_xlim(0, pi)
284-
ax.set_ylim(0, np.max(spect))
285-
ax.set_xlabel('frequency')
286-
ax.set_ylabel('spectrum')
287-
if show:
288-
plt.show()
289-
290-
def plot_autocovariance(self, ax=None, show=True):
291-
if show:
292-
fig, ax = plt.subplots()
293-
ax.set_title('Autocovariance')
294-
acov = self.autocovariance()
295-
ax.stem(list(range(len(acov))), acov)
296-
ax.set_xlim(-0.5, len(acov) - 0.5)
297-
ax.set_xlabel('time')
298-
ax.set_ylabel('autocovariance')
299-
if show:
300-
plt.show()
301-
302-
def plot_simulation(self, ax=None, show=True):
303-
if show:
304-
fig, ax = plt.subplots()
305-
ax.set_title('Sample path')
306-
x_out = self.simulation()
307-
ax.plot(x_out)
308-
ax.set_xlabel('time')
309-
ax.set_ylabel('state space')
310-
if show:
311-
plt.show()
312-
313-
def quad_plot(self):
314-
"""
315-
Plots the impulse response, spectral_density, autocovariance,
316-
and one realization of the process.
317-
318-
"""
319-
num_rows, num_cols = 2, 2
320-
fig, axes = plt.subplots(num_rows, num_cols, figsize=(12, 8))
321-
plt.subplots_adjust(hspace=0.4)
322-
plot_functions = [self.plot_impulse_response,
323-
self.plot_spectral_density,
324-
self.plot_autocovariance,
325-
self.plot_simulation]
326-
for plot_func, ax in zip(plot_functions, axes.flatten()):
327-
plot_func(ax, show=False)
328-
plt.show()

quantecon/meta.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ requirements:
3232
# - numpy
3333
# - scipy
3434
# - pandas
35-
# - matplotlib
3635

3736
run:
3837
- python
3938
- numpy
4039
- scipy
4140
- pandas
42-
- matplotlib
4341

4442
test:
4543
# Python imports

quantecon/tests/matplotlibrc

-2
This file was deleted.

quantecon/util/tests/test_timing.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Authors: Pablo Winant
44
Tests for timing.py
55
"""
6+
from numpy.testing import assert_allclose
7+
68

79
def test_tic_tac_toc():
810

@@ -22,9 +24,9 @@ def test_tic_tac_toc():
2224
time.sleep(h)
2325
el3 = toc()
2426

25-
assert(abs(el1-h)<0.01)
26-
assert(abs(el2-h)<0.01)
27-
assert(abs(el3-h*3)<0.01)
27+
rtol = 0.1
28+
for actual, desired in zip([el1, el2, el3], [h, h, h*3]):
29+
assert_allclose(actual, desired, rtol=rtol)
2830

2931

3032
if __name__ == "__main__":

rtd-environment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ dependencies:
66
- numpy
77
- numpydoc
88
- scipy
9-
- matplotlib
109
- pandas
1110
- statsmodels
1211
- sympy

0 commit comments

Comments
 (0)