pysindy
                                
                                
                                
                                    pysindy copied to clipboard
                            
                            
                            
                        Save DifferentiationMethod smoothed values
This change now allows differentiation methods that implicitly smooth x to store that smoothed value in the paramter smoothed_x_ so that SINDy can use it in the feature library.  Currently, this is only SmoothedFiniteDifference, but upon acceptance of https://github.com/andgoldschmidt/derivative/pull/15, SINDyDerivative where kind="kalman" will also implement it.  The hope is that using smoothed coordinate values will help in higher-noise cases.
I've made this a draft PR, however, because the last step is bumping the derivative package requirement to whatever is released after that PR is done.  This PR will fail tests until then.  That said, the code itself is ready for review.
API changes:
BaseDifferentiationand subclasses gain asmoothed_x_attribute.SmoothedFiniteDifferenceandSINDyDerivativegain a kwargsave_smooth=True, which can be set toFalseto disable the new behavior (and store the unsmoothed Xs insmoothed_x_.BaseFeatureLibrary.calc_trajectory()(and its subclasses) now return a tuple ofx, x_dot(the integral forWeakPDELibrary) instead of just the second tuple element. ("breaking" change, and the main reason that I tagged the last release ofmasteras pre-release)
Other chages:
- Example 5 (Differentiation Methods) adds Kalman smoothing and shows the effects of using the smoothed x in the feature libraries (it works better, no surprise there)
 - Example 5 offloads some plotting code into it's own utils.py module, making the overall notebook easier to read.
 - Tests added for API changes.
 
Sorry for so many PRs :bowtie:... This should be the last major change I submit before my general exam at the end of September. Only bugfixes and updating notebooks to the new format between now and then.