|
6 | 6 | """ |
7 | 7 | import numpy as np |
8 | 8 | from numpy import conj, pi |
9 | | -from scipy.signal import dimpulse, freqz, dlsim |
10 | 9 | from .util import check_random_state |
11 | 10 |
|
12 | 11 |
|
@@ -61,6 +60,7 @@ class ARMA: |
61 | 60 | processing we desire. Corresponds with the theta values |
62 | 61 |
|
63 | 62 | """ |
| 63 | + from scipy.signal import dimpulse, freqz, dlsim |
64 | 64 |
|
65 | 65 | def __init__(self, phi, theta=0, sigma=1): |
66 | 66 | self._phi, self._theta = phi, theta |
@@ -166,7 +166,7 @@ def impulse_response(self, impulse_length=30): |
166 | 166 |
|
167 | 167 | """ |
168 | 168 | sys = self.ma_poly, self.ar_poly, 1 |
169 | | - times, psi = dimpulse(sys, n=impulse_length) |
| 169 | + times, psi = ARMA.dimpulse(sys, n=impulse_length) |
170 | 170 | psi = psi[0].flatten() # Simplify return value into flat array |
171 | 171 |
|
172 | 172 | return psi |
@@ -205,7 +205,7 @@ def spectral_density(self, two_pi=True, res=1200): |
205 | 205 | The frequency response |
206 | 206 |
|
207 | 207 | """ |
208 | | - w, h = freqz(self.ma_poly, self.ar_poly, worN=res, whole=two_pi) |
| 208 | + w, h = ARMA.freqz(self.ma_poly, self.ar_poly, worN=res, whole=two_pi) |
209 | 209 | spect = h * conj(h) * self.sigma**2 |
210 | 210 |
|
211 | 211 | return w, spect |
@@ -253,6 +253,6 @@ def simulation(self, ts_length=90, random_state=None): |
253 | 253 |
|
254 | 254 | sys = self.ma_poly, self.ar_poly, 1 |
255 | 255 | u = random_state.randn(ts_length, 1) * self.sigma |
256 | | - vals = dlsim(sys, u)[1] |
| 256 | + vals = ARMA.dlsim(sys, u)[1] |
257 | 257 |
|
258 | 258 | return vals.flatten() |
0 commit comments