File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from tomobar .fourier import calc_filter
2+ from numpy .testing import assert_allclose
3+ import pytest
4+
5+
6+ @pytest .mark .parametrize (
7+ "test_case" ,
8+ [
9+ ("none" , 100 ),
10+ ("ramp" , 0.496701 ),
11+ ("shepp" , 0.447188 ),
12+ ("cosine" , 0.25168 ),
13+ ("cosine2" , 0.164889 ),
14+ ("hamming" , 0.185245 ),
15+ ("hann" , 0.164889 ),
16+ ("parzen" , 0.042508 ),
17+ ],
18+ )
19+ def test_calc_filter (test_case ):
20+ filter_name , expected_median = test_case
21+ length = 100
22+ f = calc_filter (length , filter_name , 1.0 )
23+ assert f .size == length / 2 + 1
24+ f = f .get ()
25+ f .sort ()
26+ assert_allclose (f [f .size // 2 ], expected_median , rtol = 1e-5 )
Original file line number Diff line number Diff line change @@ -100,9 +100,7 @@ def _wint(n, t):
100100 for j in range (N - n + 1 ):
101101 # Change coordinates, and constant and linear parts
102102 W = ((t [j + n - 1 ] - t [j ]) ** 2 ) * W1 + (t [j + n - 1 ] - t [j ]) * t [j ] * W2
103-
104- for k in range (n - 1 ):
105- w [j : j + n ] = w [j : j + n ] + p [j + k ] * W [:, k ]
103+ w [j : j + n ] += W @ p [j : j + n - 1 ]
106104
107105 wn = w
108106 wn [- 40 :] = (w [- 40 ]) / (N - 40 ) * np .arange (N - 40 , N )
You can’t perform that action at this time.
0 commit comments