File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,27 @@ def test_acorr(fig_test, fig_ref):
170
170
ax_ref .axhline (y = 0 , xmin = 0 , xmax = 1 )
171
171
172
172
173
+ @check_figures_equal (extensions = ["png" ])
174
+ def test_acorr_integers (fig_test , fig_ref ):
175
+ np .random .seed (19680801 )
176
+ Nx = 51
177
+ x = (np .random .rand (Nx ) * 10 ).cumsum ()
178
+ x = (np .ceil (x )).astype (np .int64 )
179
+ maxlags = Nx - 1
180
+
181
+ ax_test = fig_test .subplots ()
182
+ ax_test .acorr (x , maxlags = maxlags )
183
+
184
+ ax_ref = fig_ref .subplots ()
185
+
186
+ # Normalized autocorrelation
187
+ norm_auto_corr = np .correlate (x , x , mode = "full" )/ np .dot (x , x )
188
+ lags = np .arange (- maxlags , maxlags + 1 )
189
+ norm_auto_corr = norm_auto_corr [Nx - 1 - maxlags :Nx + maxlags ]
190
+ ax_ref .vlines (lags , [0 ], norm_auto_corr )
191
+ ax_ref .axhline (y = 0 , xmin = 0 , xmax = 1 )
192
+
193
+
173
194
@check_figures_equal (extensions = ["png" ])
174
195
def test_spy (fig_test , fig_ref ):
175
196
np .random .seed (19680801 )
You can’t perform that action at this time.
0 commit comments