33from pytest import mark
44from warnings import warn
55
6+ from ..finite_difference import first_order , second_order , fourth_order
67from ..linear_model import lineardiff , polydiff , savgoldiff , spectraldiff
78from ..total_variation_regularization import velocity , acceleration , jerk , iterative_velocity , smooth_acceleration , jerk_sliding
89from ..kalman_smooth import constant_velocity , constant_acceleration , constant_jerk
910from ..smooth_finite_difference import mediandiff , meandiff , gaussiandiff , friedrichsdiff , butterdiff , splinediff
10- from ..finite_difference import first_order , second_order
11- # Function aliases for testing cases where parameters change the behavior in a big way
11+ # Function alias for testing a case where parameters change the behavior in a big way
1212def iterated_first_order (* args , ** kwargs ): return first_order (* args , ** kwargs )
1313
1414dt = 0.1
@@ -33,6 +33,7 @@ def iterated_first_order(*args, **kwargs): return first_order(*args, **kwargs)
3333 (first_order , {}), # empty dictionary for the case of no parameters. no params -> no diff in new vs old
3434 (iterated_first_order , {'num_iterations' :5 }), (iterated_first_order , [5 ], {'iterate' :True }),
3535 (second_order , {}),
36+ (fourth_order , {}),
3637 (lineardiff , {'order' :3 , 'gamma' :5 , 'window_size' :11 , 'solver' :'CLARABEL' }), (lineardiff , [3 , 5 , 11 ], {'solver' :'CLARABEL' }),
3738 (polydiff , {'polynomial_order' :2 , 'window_size' :3 }), (polydiff , [2 , 3 ]),
3839 (savgoldiff , {'polynomial_order' :2 , 'window_size' :4 , 'smoothing_win' :4 }), (savgoldiff , [2 , 4 , 4 ]),
@@ -60,23 +61,29 @@ def iterated_first_order(*args, **kwargs): return first_order(*args, **kwargs)
6061# big ol' table by the method, then the test function, then the pair of quantities we're comparing.
6162error_bounds = {
6263 first_order : [[(- 25 , - 25 ), (- 25 , - 25 ), (0 , 0 ), (1 , 1 )],
63- [(- 25 , - 25 ), (- 13 , - 14 ), (0 , 0 ), (1 , 1 )],
64- [(- 25 , - 25 ), (0 , 0 ), (0 , 0 ), (1 , 0 )],
64+ [(- 25 , - 25 ), (- 13 , - 13 ), (0 , 0 ), (1 , 1 )],
6565 [(- 25 , - 25 ), (0 , 0 ), (0 , 0 ), (1 , 1 )],
66+ [(- 25 , - 25 ), (1 , 0 ), (0 , 0 ), (1 , 1 )],
6667 [(- 25 , - 25 ), (2 , 2 ), (0 , 0 ), (2 , 2 )],
6768 [(- 25 , - 25 ), (3 , 3 ), (0 , 0 ), (3 , 3 )]],
68- iterated_first_order : [[(- 8 , - 9 ), (- 11 , - 11 ), (0 , - 1 ), (0 , 0 )],
69- [(- 6 , - 6 ), (- 6 , - 7 ), (0 , - 1 ), (0 , 0 )],
70- [(- 1 , - 1 ), (0 , 0 ), (0 , - 1 ), (0 , 0 )],
71- [(0 , 0 ), (1 , 0 ), (0 , 0 ), (1 , 0 )],
72- [(1 , 1 ), (2 , 2 ), (1 , 1 ), (2 , 2 )],
73- [(1 , 1 ), (3 , 3 ), (1 , 1 ), (3 , 3 )]],
69+ iterated_first_order : [[(- 8 , - 9 ), (- 25 , - 25 ), (0 , 0 ), (1 , 1 )],
70+ [(- 6 , - 6 ), (- 6 , - 7 ), (0 , 0 ), (1 , 1 )],
71+ [(1 , 0 ), (1 , 0 ), (1 , 1 ), (1 , 1 )],
72+ [(1 , 0 ), (1 , 1 ), (1 , 0 ), (1 , 1 )],
73+ [(2 , 2 ), (3 , 2 ), (2 , 2 ), (3 , 2 )],
74+ [(2 , 2 ), (3 , 3 ), (2 , 2 ), (3 , 3 )]],
7475 second_order : [[(- 25 , - 25 ), (- 25 , - 25 ), (0 , 0 ), (1 , 1 )],
7576 [(- 25 , - 25 ), (- 13 , - 13 ), (0 , 0 ), (1 , 1 )],
7677 [(- 25 , - 25 ), (- 13 , - 13 ), (0 , 0 ), (1 , 1 )],
7778 [(- 25 , - 25 ), (0 , - 1 ), (0 , 0 ), (1 , 1 )],
7879 [(- 25 , - 25 ), (1 , 1 ), (0 , 0 ), (1 , 1 )],
7980 [(- 25 , - 25 ), (3 , 3 ), (0 , 0 ), (3 , 3 )]],
81+ fourth_order : [[(- 25 , - 25 ), (- 25 , - 25 ), (0 , 0 ), (1 , 1 )],
82+ [(- 25 , - 25 ), (- 13 , - 13 ), (0 , 0 ), (1 , 1 )],
83+ [(- 25 , - 25 ), (- 13 , - 13 ), (0 , 0 ), (1 , 1 )],
84+ [(- 25 , - 25 ), (- 2 , - 2 ), (0 , 0 ), (1 , 1 )],
85+ [(- 25 , - 25 ), (1 , 0 ), (0 , 0 ), (1 , 1 )],
86+ [(- 25 , - 25 ), (2 , 2 ), (0 , 0 ), (2 , 2 )]],
8087 lineardiff : [[(- 6 , - 6 ), (- 5 , - 6 ), (0 , - 1 ), (0 , 0 )],
8188 [(0 , 0 ), (1 , 1 ), (0 , 0 ), (1 , 1 )],
8289 [(1 , 0 ), (2 , 2 ), (1 , 0 ), (2 , 2 )],
0 commit comments