Skip to content

addressing #70#132

Merged
pavelkomarov merged 6 commits intomasterfrom
autometamethod
Jul 25, 2025
Merged

addressing #70#132
pavelkomarov merged 6 commits intomasterfrom
autometamethod

Conversation

@pavelkomarov
Copy link
Collaborator

Very simple automatic metamethod. We're currently still requiring the user to give a cutoff frequency or ground truth.

'window_size': [3, 10, 30, 50, 90, 130]},
{'gamma': (1e-4, 1e7),
'window_size': (1, 1000)}),
'window_size': (3, 1000)}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator Author

@pavelkomarov pavelkomarov Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I raised this warning for other methods, but not for this one.

@pavelkomarov pavelkomarov merged commit 4477454 into master Jul 25, 2025
1 check passed
@pavelkomarov pavelkomarov deleted the autometamethod branch July 29, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant