Skip to content

Commit d0f6cd4

Browse files
authored
Merge pull request #103 from florisvb/readme-roadsigns
readme roadsigns
2 parents 14751af + 416136d commit d0f6cd4

5 files changed

Lines changed: 35 additions & 57 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,4 @@ dist
117117
*.whl
118118
.vscode
119119
docs/build
120+
pynumdiff/_version.py

README.md

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -49,43 +49,19 @@ For more details, refer to [this paper](https://doi.org/10.1109/ACCESS.2020.3034
4949

5050
## Structure
5151

52-
PyNumDiff/
53-
|- README.md
54-
|- pynumdiff/
55-
|- __init__.py
56-
|- __version__.py
57-
|- finite_difference/
58-
|- kalman_smooth/
59-
|- linear_model/
60-
|- smooth_finite_difference/
61-
|- total_variation_regularization/
62-
|- utils/
63-
|- optimize/
64-
|- __init__.py
65-
|- __optimize__.py
66-
|- finite_difference/
67-
|- kalman_smooth/
68-
|- linear_model/
69-
|- smooth_finite_difference/
70-
|- total_variation_regularization/
71-
|- tests/
72-
|- examples
73-
|- 1_basic_tutorial.ipynb
74-
|- 2a_optimizing_parameters_with_dxdt_known.ipynb
75-
|- 2b_optimizing_parameters_with_dxdt_unknown.ipynb
76-
|- docs/
77-
|- Makefile
78-
|- make.bat
79-
|- build/
80-
|- source/
81-
|- _static
82-
|- _summaries
83-
|- conf.py
84-
|- index.rst
85-
|- ...
86-
|- .gitignore
87-
|- LICENSE.txt
88-
|- pyproject.toml
52+
- `.github/workflows` contains `.yaml` that configures our GitHub Actions continuous integration (CI) runs.
53+
- `docs/` contains `make` files and `.rst` files to govern the way `sphinx` builds documentation, either locally by navigating to this folder and calling `make html` or in the cloud by `readthedocs.io`.
54+
- `examples/` contains Jupyter notebooks that demonstrate some usage of the library.
55+
- `pynumdiff/` contains the source code. For a full list of modules and further navigation help, see the readme in this subfolder.
56+
- `.editorconfig` ensures tabs are displayed as 4 characters wide.
57+
- `.gitignore` ensures files generated by local `pip install`s, Jupyter notebook runs, caches from code runs, virtual environments, and more are not picked up by `git` and accidentally added to the repo.
58+
- `.pylintrc` configures `pylint`, a tool for autochecking code quality.
59+
- `.readthedocs.yaml` configures `readthedocs` and is necessary for documentation to get auto-rebuilt.
60+
- `CITATION.cff` is citation information for the Journal of Open-Source Software (JOSS) paper associated with this project.
61+
- `LICENSE.txt` allows free usage of this project.
62+
- `README.md` is the text you're reading, hello.
63+
- `linting.py` is a script to run `pylint`.
64+
- `pyproject.toml` governs how this package is set up and installed, including dependencies.
8965

9066
## Citation
9167

@@ -121,11 +97,12 @@ See CITATION.cff file as well as the following references.
12197

12298
### Prerequisite
12399

124-
PyNumDiff requires common packages like `numpy`, `scipy`, `matplotlib`, `pytest` (for unittests), `pylint`
125-
(for PEP8 style check). For a full list, you can check the file [pyproject.toml](pyproject.toml)
100+
PyNumDiff requires common packages like `numpy`, `scipy`, and `matplotlib`. For a full list, you can check the file [pyproject.toml](pyproject.toml)
126101

127102
In addition, it also requires certain additional packages for select functions, though these are not required for a successful install of PyNumDiff:
128-
* Total Variation Regularization methods: [`cvxpy`](http://www.cvxpy.org/install/index.html)
103+
- Total Variation Regularization methods: [`cvxpy`](http://www.cvxpy.org/install/index.html)
104+
- `pytest` for unittests
105+
- `pylint` for PEP8 style check
129106

130107
When using `cvxpy`, our default solver is set to be `MOSEK` (highly recommended), you would need to download their
131108
free academic license from their [website](https://www.mosek.com/products/academic-licenses/). Otherwise, you can also
@@ -147,7 +124,6 @@ again.
147124

148125
<em>Note: If using the optional MOSEK solver for cvxpy you will also need a [MOSEK license](https://www.mosek.com/products/academic-licenses/), free academic license.</em>
149126

150-
151127
## Usage
152128

153129
**PyNumDiff** uses [Sphinx](http://www.sphinx-doc.org/en/stable/) for code documentation.
@@ -189,25 +165,23 @@ We will frequently update simple examples for demo purposes, and here are curren
189165
* Parameter Optimization with known ground truth (only for demonstration purpose): [2a_optimizing_parameters_with_dxdt_known.ipynb](examples/2a_optimizing_parameters_with_dxdt_known.ipynb)
190166
* Parameter Optimization with unknown ground truth: [2b_optimizing_parameters_with_dxdt_unknown.ipynb](./examples/2b_optimizing_parameters_with_dxdt_unknown.ipynb)
191167

192-
193168
### Important notes
194169

195170
* Larger values of `tvgamma` produce smoother derivatives
196171
* The value of `tvgamma` is largely universal across methods, making it easy to compare method results
197172
* The optimization is not fast. Run it on subsets of your data if you have a lot of data. It will also be much faster with faster differentiation methods, like savgoldiff and butterdiff, and probably too slow for sliding methods like sliding DMD and sliding LTI fit.
198173
* 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)`
199174

200-
201175
### Running the tests
202176

203-
We are using Travis CI for continuous intergration testing. You can check out the current status
204-
[here](https://travis-ci.com/github/florisvb/PyNumDiff).
177+
We are using GitHub Actions for continuous intergration testing.
205178

206179
To run tests locally, type:
207180
```bash
208181
> pytest pynumdiff
209182
```
210183

184+
Add the flag `--plot` to see plots of the methods against test functions.
211185

212186
## License
213187

linting.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
# -*- coding: utf-8 -*-
2-
import re
3-
import sys
4-
import argparse
2+
import re, sys, argparse
53
from pylint import lint
64

5+
# Call `echo $?` to see the exit code after a run. If the score is over this, the exit
6+
# code will be 0 (success), and if not will be nonzero (failure).
77
THRESHOLD = 8.5
88

99
if len(sys.argv) < 2:
1010
raise argparse.ArgumentError("Module to evaluate needs to be the first argument")
1111

1212
sys.argv[1] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[1])
13-
run = lint.Run([sys.argv[1]], do_exit=False)
14-
score = run.linter.stats['global_note']
15-
16-
if score < THRESHOLD:
17-
print("Your code doesn't pass the PEP8 style score threshold: %f!" % THRESHOLD)
18-
sys.exit(1)
19-
20-
print("Congratulations! Your code has passed the PEP8 style score threshold: %f!" % THRESHOLD)
13+
run = lint.Run([sys.argv[1], f"--fail-under={THRESHOLD}"])

pynumdiff/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

pynumdiff/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- `finite_difference` contains basic first and second order finite differencing methods. The first order method supports iterative application.
2+
- `kalman_smooth` contains Kalman filtering and smoothing methods, currently constant-derivative methods up to 3rd order (jerk) and a classic linear Kalman Filter based on known dynamics.
3+
- `linear_model` is a bit of a miscellaneous module, containing methods which work linearly: `lineardiff`, `polydiff`, `savgoldiff`, and `spectraldiff`.
4+
- `optimize` contains code to find best parameter settings for methods, tuned using Nelder-Mead according to the paper "Numerical differentiation of noisy data: A unifying multi-objective optimization framework"
5+
- `smooth_finite_difference` contains methods which do a smoothing step followed by simple finite difference.
6+
- `tests` contains `pytest` unit tests of
7+
1. all the differentiation methods, checking their results against a suite of known analytic functions (including an ability to plot if the `--plot` command is passed to `pytest`, see `conftest.py`)
8+
2. the optimizer
9+
3. utilities, auxiliary functions used throughout the code
10+
- `total_variation_regularization` contains code to take the derivative based on a finite differencing scheme which is regularized by shrinking changes of value in some derivative (1st, 2nd, or 3rd order)
11+
- `utils` contains `utility` functions used throughout differentation methods, `evaluate` functions used by the parameter optimizer, and `simulate` examples for demonstrating and testing the methods.

0 commit comments

Comments
 (0)