-
Notifications
You must be signed in to change notification settings - Fork 22
supporting variable dt with optimize #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| dxdt_hat[0] = x_hat[1] - x_hat[0] | ||
| dxdt_hat[-1] = x_hat[-1] - x_hat[-2] # use first-order endpoint formulas so as not to amplify noise. See #104 | ||
|
|
||
| x_hat = utility.integrate_dxdt_hat(dxdt_hat, dt=1) # estimate new x_hat by integrating derivative |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the name of this thing, so kwarg breaks.
| t = _t | ||
|
|
||
| # The below does the approximate equivalent of this code, but sparsely in O(N sigma), since the rbf falls off rapidly | ||
| # The below does the approximate equivalent of this code, but sparsely in O(N sigma^2), since the rbf falls off rapidly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solving a sparse linear system with
| :return: **x_hat** (np.array[float]) -- integral of dxdt_hat | ||
| """ | ||
| return np.hstack((0, scipy.integrate.cumulative_trapezoid(dxdt_hat)))*dt | ||
| return cumulative_trapezoid(dxdt_hat, initial=0)*_t if np.isscalar(_t) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out cumulative_trapezoid can also take an initial value, in which case it returns a result the same length as the thing it's integrating, so there is no need to call hstack.
|
No idea why the optimize test I added is causing the build to take many times longer than usual (I canceled after 15 minutes one time and 6 another, and it usually takes under 2). That test takes about 30 seconds locally and passes fine. Chat thinks it could be a random number generator blocking, waiting for entropy? But the 15 minute run was from before I added seeding in the test. |
Just needed the integration utility to handle variable dt, really, and scipy's function already does, because they're awesome.