Conversation
…ook to demonstrate usage of method finder, improved a comment in the utils, removed some whitespace in the 2b notebook
| 'window_size': [3, 10, 30, 50, 90, 130]}, | ||
| {'gamma': (1e-4, 1e7), | ||
| 'window_size': (1, 1000)}), | ||
| 'window_size': (3, 1000)}), |
There was a problem hiding this comment.
A window size of 1 isn't really doing any smoothing.
| if window_size % 2 == 0: | ||
| window_size += 1 # has to be odd | ||
| warn("Kernel window size should be odd. Added 1 to length.") | ||
| ramp = window_size//5 |
There was a problem hiding this comment.
If the window_size is too small, ramp can end up being 0. If I set it to have a minimum value of 1, then that change alone is insufficient and causes indexing errors deeper in the slide_function or divide-by-zero errors even deeper in the solvers. Perhaps there is a way to catch and deal with those, but not without more significant debugging and tracing. Instead, I've decided sliding jerk isn't really a reasonable thing to do below a certain window size and am simply calling jerk in that case.
| dxdt_hat[:2] = np.diff(x_hat[:3]) | ||
| dxdt_hat[-2:] = np.diff(x_hat[-3:]) | ||
| dxdt_hat[1] = (x_hat[2] - x_hat[0])/2 | ||
| dxdt_hat[-2] = (x_hat[-1] - x_hat[-3])/2 # use second-order formula for next-to-endpoints so as not to amplify noise |
There was a problem hiding this comment.
Off theme for this PR, sorry.
| if window_size % 2 == 0: window_size += 1 # window_size needs to be odd | ||
| if window_size % 2 == 0: | ||
| window_size += 1 # window_size needs to be odd | ||
| warn("Kernel window size should be odd. Added 1 to length.") |
There was a problem hiding this comment.
I raised this warning for other methods, but not for this one.
Very simple automatic metamethod. We're currently still requiring the user to give a cutoff frequency or ground truth.