|
|
@ -98,118 +98,13 @@ def test_detrendma():
|
|
|
|
y = exp(x) + 0.1 * cos(20 * 2 * pi * x)
|
|
|
|
y = exp(x) + 0.1 * cos(20 * 2 * pi * x)
|
|
|
|
y0 = detrendma(y, 20)
|
|
|
|
y0 = detrendma(y, 20)
|
|
|
|
tr = y - y0
|
|
|
|
tr = y - y0
|
|
|
|
|
|
|
|
print(y0[::40])
|
|
|
|
|
|
|
|
print(tr[::40])
|
|
|
|
assert_array_almost_equal(
|
|
|
|
assert_array_almost_equal(
|
|
|
|
y0,
|
|
|
|
y0[::40], [-0.01058152, 0.09386986, 0.0903801, 0.08510006,
|
|
|
|
array(
|
|
|
|
0.07803487])
|
|
|
|
[-1.05815186e-02, -2.48280355e-02, -7.01800760e-02,
|
|
|
|
assert_array_almost_equal(tr[::40], [1.11058152, 1.22796459, 1.50127309,
|
|
|
|
-1.27193089e-01, -1.71915213e-01, -1.85125121e-01,
|
|
|
|
1.8354286, 2.24397967])
|
|
|
|
-1.59745361e-01, -1.03571981e-01, -3.62676515e-02,
|
|
|
|
|
|
|
|
1.82219951e-02, 4.09039083e-02, 2.50630186e-02,
|
|
|
|
|
|
|
|
-2.11478040e-02, -7.78521440e-02, -1.21116040e-01,
|
|
|
|
|
|
|
|
-1.32178923e-01, -1.04689244e-01, -4.71541301e-02,
|
|
|
|
|
|
|
|
2.03417510e-02, 7.38826137e-02, 8.95349902e-02,
|
|
|
|
|
|
|
|
6.68738432e-02, 1.46828486e-02, -4.68648556e-02,
|
|
|
|
|
|
|
|
-9.39871606e-02, -1.08465407e-01, -8.46710629e-02,
|
|
|
|
|
|
|
|
-3.17365657e-02, 2.99669288e-02, 7.66864134e-02,
|
|
|
|
|
|
|
|
9.04482283e-02, 6.59902473e-02, 1.27914062e-02,
|
|
|
|
|
|
|
|
-4.85841870e-02, -9.44185349e-02, -1.06987444e-01,
|
|
|
|
|
|
|
|
-8.13964951e-02, -2.74687460e-02, 3.40438793e-02,
|
|
|
|
|
|
|
|
7.94643163e-02, 9.13222681e-02, 6.50922520e-02,
|
|
|
|
|
|
|
|
1.09390148e-02, -5.02028639e-02, -9.47031411e-02,
|
|
|
|
|
|
|
|
-1.05349757e-01, -7.79872833e-02, -2.31196073e-02,
|
|
|
|
|
|
|
|
3.81412653e-02, 8.22178144e-02, 9.21605209e-02,
|
|
|
|
|
|
|
|
6.41850565e-02, 9.13184690e-03, -5.17149253e-02,
|
|
|
|
|
|
|
|
-9.48363260e-02, -1.03549587e-01, -7.44424124e-02,
|
|
|
|
|
|
|
|
-1.86890490e-02, 4.22594607e-02, 8.49486437e-02,
|
|
|
|
|
|
|
|
9.29666543e-02, 6.32740911e-02, 7.37625254e-03,
|
|
|
|
|
|
|
|
-5.31142920e-02, -9.48133620e-02, -1.01584110e-01,
|
|
|
|
|
|
|
|
-7.07607748e-02, -1.41768231e-02, 4.63990484e-02,
|
|
|
|
|
|
|
|
8.76587937e-02, 9.37446001e-02, 6.23650231e-02,
|
|
|
|
|
|
|
|
5.67876495e-03, -5.43947621e-02, -9.46294406e-02,
|
|
|
|
|
|
|
|
-9.94504301e-02, -6.69411601e-02, -9.58252265e-03,
|
|
|
|
|
|
|
|
5.05608316e-02, 9.03505172e-02, 9.44985623e-02,
|
|
|
|
|
|
|
|
6.14637631e-02, 4.04610591e-03, -5.55500040e-02,
|
|
|
|
|
|
|
|
-9.42796647e-02, -9.71455674e-02, -6.29822440e-02,
|
|
|
|
|
|
|
|
-4.90556961e-03, 5.47458452e-02, 9.30263409e-02,
|
|
|
|
|
|
|
|
9.52330253e-02, 6.05764719e-02, 2.48519180e-03,
|
|
|
|
|
|
|
|
-5.65735506e-02, -9.37590405e-02, -9.46664506e-02,
|
|
|
|
|
|
|
|
-5.88825766e-02, -1.45202622e-04, 5.89553685e-02,
|
|
|
|
|
|
|
|
9.56890756e-02, 9.59527629e-02, 5.97095676e-02,
|
|
|
|
|
|
|
|
1.00314001e-03, -5.74587921e-02, -9.30624694e-02,
|
|
|
|
|
|
|
|
-9.20099048e-02, -5.46405701e-02, 4.69953603e-03,
|
|
|
|
|
|
|
|
6.31909369e-02, 9.83418277e-02, 9.66628470e-02,
|
|
|
|
|
|
|
|
5.88697331e-02, -3.92724035e-04, -5.81989687e-02,
|
|
|
|
|
|
|
|
-9.21847386e-02, -8.91726414e-02, -5.02544862e-02,
|
|
|
|
|
|
|
|
9.62981387e-03, 6.74543554e-02, 1.00988010e-01,
|
|
|
|
|
|
|
|
9.73686580e-02, 5.80639242e-02, -1.69485946e-03,
|
|
|
|
|
|
|
|
-5.87871620e-02, -9.11205115e-02, -8.61512458e-02,
|
|
|
|
|
|
|
|
-4.57224228e-02, 1.46470222e-02, 7.17477118e-02,
|
|
|
|
|
|
|
|
1.03631355e-01, 9.80758938e-02, 5.72993780e-02,
|
|
|
|
|
|
|
|
-2.89550192e-03, -5.92162868e-02, -8.98643173e-02,
|
|
|
|
|
|
|
|
-8.29421650e-02, -4.10422999e-02, 1.97527907e-02,
|
|
|
|
|
|
|
|
7.60733908e-02, 1.06275925e-01, 9.87905812e-02,
|
|
|
|
|
|
|
|
5.65836223e-02, -3.98665495e-03, -5.94790815e-02,
|
|
|
|
|
|
|
|
-8.84105398e-02, -7.95416952e-02, -3.62118451e-02,
|
|
|
|
|
|
|
|
2.49490024e-02, 8.04340881e-02, 1.08926128e-01,
|
|
|
|
|
|
|
|
9.95190863e-02, 5.59244846e-02, -4.96008086e-03,
|
|
|
|
|
|
|
|
-5.95680980e-02, -8.67534061e-02, -7.59459673e-02,
|
|
|
|
|
|
|
|
-3.12285782e-02, 3.02378095e-02, 8.48328258e-02,
|
|
|
|
|
|
|
|
1.11586726e-01, 1.00268126e-01, 5.53301029e-02,
|
|
|
|
|
|
|
|
-5.80729079e-03, -5.94756912e-02, -8.48869734e-02,
|
|
|
|
|
|
|
|
-7.21509330e-02, -2.60897955e-02, 3.56216499e-02,
|
|
|
|
|
|
|
|
8.92729678e-02, 1.14262857e-01, 1.01044781e-01,
|
|
|
|
|
|
|
|
5.48089359e-02, -6.51953427e-03, -5.91940075e-02,
|
|
|
|
|
|
|
|
-8.28051165e-02, -6.81523491e-02, -2.07925530e-02,
|
|
|
|
|
|
|
|
4.11032641e-02, 9.37582360e-02, 1.16960041e-01,
|
|
|
|
|
|
|
|
1.13824241e-01, 7.82451609e-02, 2.87461256e-02,
|
|
|
|
|
|
|
|
-1.07566250e-02, -2.01779675e-02, 8.98967999e-03,
|
|
|
|
|
|
|
|
7.03952281e-02, 1.45278564e-01, 2.09706186e-01,
|
|
|
|
|
|
|
|
2.43802139e-01, 2.39414013e-01, 2.03257341e-01,
|
|
|
|
|
|
|
|
1.54325635e-01, 1.16564992e-01, 1.09638547e-01,
|
|
|
|
|
|
|
|
1.41342814e-01, 2.04600808e-01, 2.80191671e-01,
|
|
|
|
|
|
|
|
3.44164010e-01, 3.77073744e-01
|
|
|
|
|
|
|
|
]))
|
|
|
|
|
|
|
|
assert_array_almost_equal(tr, array([
|
|
|
|
|
|
|
|
1.11058152, 1.11058152, 1.11058152, 1.11058152, 1.11058152,
|
|
|
|
|
|
|
|
1.11058152, 1.11058152, 1.11058152, 1.11058152, 1.11058152,
|
|
|
|
|
|
|
|
1.11058152, 1.11058152, 1.11058152, 1.11058152, 1.11058152,
|
|
|
|
|
|
|
|
1.11058152, 1.11058152, 1.11058152, 1.11058152, 1.11058152,
|
|
|
|
|
|
|
|
1.11599212, 1.12125245, 1.12643866, 1.13166607, 1.13704477,
|
|
|
|
|
|
|
|
1.14263723, 1.14843422, 1.15435845, 1.16029443, 1.16613308,
|
|
|
|
|
|
|
|
1.17181383, 1.17734804, 1.18281471, 1.18833001, 1.19400259,
|
|
|
|
|
|
|
|
1.19989168, 1.20598434, 1.21220048, 1.21842384, 1.22454684,
|
|
|
|
|
|
|
|
1.23051218, 1.23633498, 1.24209697, 1.24791509, 1.25389641,
|
|
|
|
|
|
|
|
1.26009689, 1.26649987, 1.27302256, 1.27954802, 1.28597031,
|
|
|
|
|
|
|
|
1.29223546, 1.29836228, 1.30443522, 1.31057183, 1.31687751,
|
|
|
|
|
|
|
|
1.32340488, 1.3301336, 1.33697825, 1.34382132, 1.35055864,
|
|
|
|
|
|
|
|
1.35713958, 1.36358668, 1.36998697, 1.37645853, 1.38310497,
|
|
|
|
|
|
|
|
1.38997553, 1.39704621, 1.40422902, 1.41140604, 1.41847493,
|
|
|
|
|
|
|
|
1.4253885, 1.43217295, 1.43891784, 1.44574164, 1.45274607,
|
|
|
|
|
|
|
|
1.45997696, 1.46740665, 1.47494469, 1.48247285, 1.48989073,
|
|
|
|
|
|
|
|
1.49715462, 1.50429437, 1.51140198, 1.51859618, 1.52597672,
|
|
|
|
|
|
|
|
1.53358594, 1.54139257, 1.5493038, 1.55720119, 1.56498641,
|
|
|
|
|
|
|
|
1.57261924, 1.58013316, 1.58762252, 1.5952062, 1.60298187,
|
|
|
|
|
|
|
|
1.61098836, 1.6191908, 1.62749412, 1.63577979, 1.64395163,
|
|
|
|
|
|
|
|
1.65197298, 1.65988092, 1.66777202, 1.67576523, 1.68395602,
|
|
|
|
|
|
|
|
1.69237968, 1.70099778, 1.70971307, 1.71840707, 1.72698583,
|
|
|
|
|
|
|
|
1.73541631, 1.74373911, 1.75205298, 1.76047677, 1.76910369,
|
|
|
|
|
|
|
|
1.77796544, 1.78702008, 1.79616827, 1.80529169, 1.81429875,
|
|
|
|
|
|
|
|
1.82316, 1.83191959, 1.84067831, 1.84955481, 1.85863994,
|
|
|
|
|
|
|
|
1.86796178, 1.87747491, 1.88707803, 1.89665308, 1.9061109,
|
|
|
|
|
|
|
|
1.91542572, 1.92464514, 1.9338719, 1.94322436, 1.9527909,
|
|
|
|
|
|
|
|
1.96259596, 1.97259069, 1.9826719, 1.99272195, 2.00265419,
|
|
|
|
|
|
|
|
2.01244653, 2.02215, 2.0318692, 2.04172204, 2.05179437,
|
|
|
|
|
|
|
|
2.06210696, 2.07260759, 2.08319129, 2.09374092, 2.10417247,
|
|
|
|
|
|
|
|
2.11446752, 2.12468051, 2.13491776, 2.14529665, 2.1559004,
|
|
|
|
|
|
|
|
2.16674609, 2.17777817, 2.18889002, 2.19996511, 2.21092214,
|
|
|
|
|
|
|
|
2.22174641, 2.23249567, 2.24327791, 2.25420982, 2.26537192,
|
|
|
|
|
|
|
|
2.2767776, 2.28836802, 2.30003501, 2.3116628, 2.32317284,
|
|
|
|
|
|
|
|
2.33455419, 2.34586786, 2.35722337, 2.36873665, 2.38048542,
|
|
|
|
|
|
|
|
2.39247934, 2.4046564, 2.41690694, 2.42911606, 2.44120808,
|
|
|
|
|
|
|
|
2.44120808, 2.44120808, 2.44120808, 2.44120808, 2.44120808,
|
|
|
|
|
|
|
|
2.44120808, 2.44120808, 2.44120808, 2.44120808, 2.44120808,
|
|
|
|
|
|
|
|
2.44120808, 2.44120808, 2.44120808, 2.44120808, 2.44120808,
|
|
|
|
|
|
|
|
2.44120808, 2.44120808, 2.44120808, 2.44120808, 2.44120808]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_findcross_and_ecross():
|
|
|
|
def test_findcross_and_ecross():
|
|
|
|