
PyNumDiff
Methods for numerical differentiation of noisy data in python
PyNumDiff is a Python package that implements many methods for computing numerical derivatives and smooth estimates of noisy data, which can be a critical step in developing dynamic models or designing control. There are seven different families of methods implemented in this repository:
- prefiltering followed by finite difference calculation
- iterated finite differencing
- polynomial fit methods
- basis function fit methods
- total variation regularization of a finite difference derivative
- generalized Kalman smoothing
- local approximation with linear model
All are ultimately smoothing with similar runtime and accuracy, but some have situational advantages over others: For example, robustdiff is specialized to handle outliers; splinediff, polydiff, rtsdiff, and robustdiff can handle missing data; splinediff, polydiff, rbfdiff, rtsdiff, and robustdiff can handle irregularly-spaced data; and rtsdiff can handle inputs on a wrapped domain, like angles. All methods can accept blocks of multidimensional data, differentiating all vectors along the dimension given by the axis parameter.
For a full list and comparison, see section 7 of our Taxonomy Paper and explore modules in the Sphinx documentation.
All methods have hyperparameters, so we take a principled approach and propose a multi-objective optimization framework for choosing settings that minimize a loss function to balance the faithfulness and smoothness of the derivative estimate. For more details, refer to this paper.



