Skip to content

Commit 218e5ea

Browse files
committed
human touch to readme, and had claude set minimum version for scipy because we actually do depend on people being up to date enough
1 parent 0da832c commit 218e5ea

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Python methods for numerical differentiation of noisy data, including multi-obje
2424

2525
## Introduction
2626

27-
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:
27+
PyNumDiff is a Python package that implements many methods for computing numerical derivatives and smooth estimates from noisy data, which can be a critical step in developing dynamic models or designing control. There are seven different families of methods in this repository:
2828

2929
1. prefiltering followed by finite difference calculation
3030
2. iterated finite differencing
@@ -34,17 +34,15 @@ PyNumDiff is a Python package that implements many methods for computing numeric
3434
6. generalized Kalman smoothing
3535
7. local approximation with linear model
3636

37-
All are ultimately smoothing with similar runtime and accuracy, but some have situational advantages over others, summarized in the table under [Usage](#usage) below.
37+
All are ultimately smoothing with similar runtime and accuracy, but some have flexibility advantages over others, summarized in the table under [Usage](#usage) below. For further details and comparison, see section 7 of our [Taxonomy Paper](https://arxiv.org/abs/2512.09090).
3838

39-
For a full list and comparison, see section 7 of our [Taxonomy Paper](https://arxiv.org/abs/2512.09090) and explore modules in the [Sphinx documentation](https://pynumdiff.readthedocs.io/master/).
40-
41-
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](https://doi.org/10.1109/ACCESS.2020.3034077).
39+
All methods have hyperparameters, described in the [Sphinx documentation](https://pynumdiff.readthedocs.io/master/). We take a principled approach and propose a multi-objective optimization framework for choosing settings that minimize a loss function that balances faithfulness to data with smoothness of the derivative estimate. For more details, refer to [this paper](https://doi.org/10.1109/ACCESS.2020.3034077).
4240

4341
## Installing
4442

45-
Dependencies are listed in [pyproject.toml](https://github.com/florisvb/PyNumDiff/blob/master/pyproject.toml). They include the usual suspects like `numpy` and `scipy`, plus `pywavelets` for `waveletdiff` and `tqdm` for the optimizer, and optionally `cvxpy`.
43+
Dependencies are listed in [pyproject.toml](https://github.com/florisvb/PyNumDiff/blob/master/pyproject.toml). They include the usual suspects like `numpy` and `scipy`, plus `pywavelets` for `waveletdiff`, `tqdm` for the optimizer, and `cvxpy` for `robustdiff` and `tvrdiff`.
4644

47-
The code is compatible with >=Python 3.10. Install from PyPI with `pip install pynumdiff`, from source with `pip install git+https://github.com/florisvb/PyNumDiff`, or from local download with `pip install .`. Call `pip install pynumdiff[advanced]` to automatically install optional dependencies from the advanced list, like [CVXPY](https://www.cvxpy.org).
45+
The code is compatible with >=Python 3.11. Install from PyPI with `pip install pynumdiff`, from source with `pip install git+https://github.com/florisvb/PyNumDiff`, or from local download with `pip install .`. Call `pip install pynumdiff[advanced]` to automatically install optional dependencies from the advanced list, like [CVXPY](https://www.cvxpy.org).
4846

4947
## Usage
5048

@@ -54,7 +52,7 @@ For more details, read our [Sphinx documentation](https://pynumdiff.readthedocs.
5452
somethingdiff(x, dt, **kwargs)
5553
```
5654

57-
where `x` is data, `dt` is a step size, and various keyword arguments control the behavior. Methods marked multidimensional take an `axis` argument selecting which dimension of a block to differentiate along, and those supporting variable step size rename the second parameter `dt_or_t`, which accepts either a constant step size or an array of sample locations. Handing a method data it doesn't support raises a `ValueError` explaining why rather than returning `NaN`s.
55+
where `x` is data, `dt` is a step size, and various keyword arguments control the behavior. Methods marked multidimensional take an `axis` argument selecting which dimension of a block to differentiate along, and those supporting variable step size rename the second parameter `dt_or_t`, which accepts either a constant step size or an array of sample locations. Handing a method data it doesn't support raises a `ValueError` explaining why.
5856

5957
| Method | Multidim | Variable step | Missing data | Outliers | Circular domain | Needs CVXPY |
6058
| --- | :-: | :-: | :-: | :-: | :-: | :-: |
@@ -72,9 +70,9 @@ where `x` is data, `dt` is a step size, and various keyword arguments control th
7270
| `robustdiff` ||||| ||
7371
| `lineardiff` | | | | | ||
7472

75-
`lineardiff` is the one method that does not yet accept `axis`; generalizing it is tracked in [#223](https://github.com/florisvb/PyNumDiff/issues/223).
73+
There is also presently a swathe of deprecated methods. Don't use them, but if you do you'll just get warnings telling you how to use whichever new-and-improved version. There are also a few minor methods kept for general interest (`iterative_velocity` and `smooth_acceleration`) but in practice dominated by or redundant with others from the table.
7674

77-
You can set the hyperparameters:
75+
You can set the hyperparameters manually with a construction like:
7876
```python
7977
from pynumdiff.submodule import method
8078

@@ -95,9 +93,7 @@ params, val = optimize(somethingdiff, x, dt, tvgamma=tvgamma, # smoothness hyper
9593
print('Optimal parameters: ', params)
9694
x_hat, dxdt_hat = somethingdiff(x, dt, **params)
9795
```
98-
If no `search_space_updates` is given, a default search space is used. See the top of `optimize.py`.
99-
100-
The following heuristic works well for choosing `tvgamma`, where `cutoff_frequency` is the highest frequency content of the signal in your data, and `dt` is the timestep: `tvgamma=np.exp(-1.6*np.log(cutoff_frequency)-0.71*np.log(dt)-5.1)`. Larger values of `tvgamma` produce smoother derivatives. The value of `tvgamma` is largely universal across methods, making it easy to compare method results. Be aware the optimization is a fairly heavy process.
96+
`tvgamma` governs the smoothness targeted by the optimization procedure, with larger values yielding smoother derivatives. Its value is dependent upon sampling rate and frequency content of the underlying signal, and it is universal across methods, making it possible to compare results post optimization. A default search space is used to initialize and perform optimiation, defined at the top of `optimize.py`, with overwrites from `search_space_updates`. Be aware the optimization is a fairly heavy process.
10197

10298
### Notebook examples
10399

@@ -128,7 +124,7 @@ Much more extensive usage is demonstrated in Jupyter notebooks, described furthe
128124

129125
## Citation
130126

131-
See CITATION.cff file as well as the following references.
127+
See CITATION.cff file, but here are some possible BibTeX entries for convenience.
132128

133129
### PyNumDiff python package:
134130

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
]
2626
dependencies = [
2727
"numpy",
28-
"scipy",
28+
"scipy>=1.15", # splinediff calls make_splrep, added in this version
2929
"matplotlib",
3030
"pywavelets",
3131
"tqdm" # optimize module imports this

0 commit comments

Comments
 (0)