|
9 | 9 | from ..smooth_finite_difference import * # mediandiff, meandiff, gaussiandiff, friedrichsdiff, butterdiff, splinediff |
10 | 10 | from ..finite_difference import first_order, second_order |
11 | 11 | # Function aliases for testing cases where parameters change the behavior in a big way |
12 | | -iterated_first_order = lambda *args, **kwargs: first_order(*args, **kwargs) |
| 12 | +def iterated_first_order(*args, **kwargs): return first_order(*args, **kwargs) |
13 | 13 |
|
14 | 14 | dt = 0.1 |
15 | 15 | t = np.arange(0, 3, dt) # sample locations |
@@ -106,10 +106,11 @@ def test_diff_method(diff_method_and_params, test_func_and_deriv, request): # re |
106 | 106 | # check x_hat and x_hat_noisy are close to x and that dxdt_hat and dxdt_hat_noisy are close to dxdt |
107 | 107 | #print("]\n[", end="") |
108 | 108 | for j,(a,b) in enumerate([(x,x_hat), (dxdt,dxdt_hat), (x,x_hat_noisy), (dxdt,dxdt_hat_noisy)]): |
109 | | - l2_error = np.linalg.norm(a - b) |
110 | | - linf_error = np.max(np.abs(a - b)) |
| 109 | + # l2_error = np.linalg.norm(a - b) |
| 110 | + # linf_error = np.max(np.abs(a - b)) |
| 111 | + # print(f"({l2_error}, {linf_error})", end=", ") |
| 112 | + # print(f"({int(np.ceil(np.log10(l2_error))) if l2_error> 0 else -25}, {int(np.ceil(np.log10(linf_error))) if linf_error > 0 else -25})", end=", ") |
111 | 113 |
|
112 | | - #print(f"({int(np.ceil(np.log10(l2_error))) if l2_error> 0 else -25}, {int(np.ceil(np.log10(linf_error))) if linf_error > 0 else -25})", end=", ") |
113 | 114 | log_l2_bound, log_linf_bound = error_bounds[diff_method][i][j] |
114 | 115 | assert np.linalg.norm(a - b) < 10**log_l2_bound |
115 | 116 | assert np.max(np.abs(a - b)) < 10**log_linf_bound |
|
0 commit comments