PyDMD: Python Dynamic Mode Decomposition
- Description
- Dependencies and installation
- Documentation
- Testing
- Examples
- How to cite
- Authors and contributors
- How to contribute
- License
PyDMD is a Python package that uses Dynamic Mode Decomposition for a data-driven model simplification based on spatiotemporal coherent structures.
Dynamic Mode Decomposition (DMD) is a model reduction algorithm developed by Schmid (see "Dynamic mode decomposition of numerical and experimental data"). Since then has emerged as a powerful tool for analyzing the dynamics of nonlinear systems. DMD relies only on the high-fidelity measurements, like experimental data and numerical simulations, so it is an equation-free algorithm. Its popularity is also due to the fact that it does not make any assumptions about the underlying system. See Kutz ("Dynamic Mode Decomposition: Data-Driven Modeling of Complex Systems") for a comprehensive overview of the algorithm and its connections to the Koopman-operator analysis, initiated in Koopman ("Hamiltonian systems and transformation in Hilbert space"), along with examples in computational fluid dynamics.
In the last years many variants arose, such as multiresolution DMD, compressed DMD, forward backward DMD, and higher order DMD among others, in order to deal with noisy data, big dataset, or spurius data for example.
In PyDMD we implemented the majority of the variants mentioned above with a user friendly interface. See the Examples section below and the Tutorials to have an idea of the potential of this package.
The research in the field is growing both in computational fluid dynamic and in structural mechanics, due to the equation-free nature of the model.
PyDMD requires requires numpy
, scipy
, matplotlib
, future
, sphinx
(for the documentation) and nose
(for local test). The code is compatible with Python 2.7 and Python 3.6. It can be installed using pip
or directly from the source code.
Mac and Linux users can install pre-built binary packages using pip. To install the package just type:
> pip install pydmd
To uninstall the package:
> pip uninstall pydmd
The official distribution is on GitHub, and you can clone the repository using
> git clone https://github.com/mathLab/PyDMD
To install the package just type:
> python setup.py install
To uninstall the package you have to rerun the installation and record the installed files in order to remove them:
> python setup.py install --record installed_files.txt
> cat installed_files.txt | xargs rm -rf
PyDMD uses Sphinx for code documentation. You can view the documentation online here. To build the html version of the docs locally simply:
> cd docs
> make html
The generated html can be found in docs/build/html
. Open up the index.html
you find there to browse.
We are using Travis CI for continuous intergration testing. You can check out the current status here.
To run tests locally (nose
is required):
> python test.py
You can find useful tutorials on how to use the package in the tutorials folder.
Here we show a simple application (taken from tutorial 2): we collect few snapshots from a toy system with some noise and reconstruct the entire system evolution.
The original snapshots used as input for the dynamic mode decomposition
The system evolution reconstructed with dynamic mode decomposition
If you use this package in your publications please cite the package as follows:
Demo et al., (2018). PyDMD: Python Dynamic Mode Decomposition. Journal of Open Source Software, 3(22), 530, https://doi.org/10.21105/joss.00530
Or if you use LaTeX:
@article{demo18pydmd,
Author = {Demo, Nicola and Tezzele, Marco and Rozza, Gianluigi},
Title = {{PyDMD: Python Dynamic Mode Decomposition}},
Journal = {The Journal of Open Source Software},
Volume = {3},
Number = {22},
Pages = {530},
Year = {2018},
Doi = {https://doi.org/10.21105/joss.00530}
}
To implement the various versions of the DMD algorithm we follow these works:
- Kutz, Brunton, Brunton, Proctor. Dynamic Mode Decomposition: Data-Driven Modeling of Complex Systems. SIAM Other Titles in Applied Mathematics, 2016. [DOI].
- Gavish, Donoho. The optimal hard threshold for singular values is 4/sqrt(3). IEEE Transactions on Information Theory, 2014. [DOI].
- Matsumoto, Indinger. On-the-fly algorithm for Dynamic Mode Decomposition using Incremental Singular Value Decomposition and Total Least Squares. 2017. [arXiv].
- Hemati, Rowley, Deem, Cattafesta. De-biasing the dynamic mode decomposition for applied Koopman spectral analysis of noisy datasets. Theoretical and Computational Fluid Dynamics, 2017. [DOI].
- Dawson, Hemati, Williams, Rowley. Characterizing and correcting for the effect of sensor noise in the dynamic mode decomposition. Experiments in Fluids, 2016. [DOI].
- Kutz, Fu, Brunton. Multiresolution Dynamic Mode Decomposition. SIAM Journal on Applied Dynamical Systems, 2016. [DOI].
- Erichson, Brunton, Kutz. Compressed dynamic mode decomposition for background modeling. Journal of Real-Time Image Processing, 2016. [DOI].
- Le Clainche, Vega. Higher Order Dynamic Mode Decomposition. Journal on Applied Dynamical Systems, 2017. [DOI].
Here there is a list of the scientific works involving PyDMD you can consult and/or cite. If you want to add one, please open a PR.
-
Tezzele, Demo, Gadalla, Mola, Rozza. Model Order Reduction by means of Active Subspaces and Dynamic Mode Decomposition for Parametric Hull Shape Design Hydrodynamics. 2018. [arXiv]].
-
Demo, Tezzele, Mola, Rozza. An efficient shape parametrisation by free-form deformation enhanced by active subspace for hull hydrodynamic ship design problems in open source environment. 2018. [arXiv].
PyDMD is currently developed and mantained at SISSA mathLab by
under the supervision of Prof. Gianluigi Rozza.
Contact us by email for further information or questions about PyDMD, or suggest pull requests. Contributions improving either the code or the documentation are welcome!
We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow.
-
It's generally best to start by opening a new issue describing the bug or feature you're intending to fix. Even if you think it's relatively minor, it's helpful to know what people are working on. Mention in the initial issue that you are planning to work on that bug or feature so that it can be assigned to you.
-
Follow the normal process of forking the project, and setup a new branch to work in. It's important that each group of changes be done in separate branches in order to ensure that a pull request only includes the commits related to that bug or feature.
-
To ensure properly formatted code, please make sure to use 4 spaces to indent the code. The easy way is to run on your bash the provided script: ./code_formatter.sh. You should also run pylint over your code. It's not strictly necessary that your code be completely "lint-free", but this will help you find common style issues.
-
Any significant changes should almost always be accompanied by tests. The project already has good test coverage, so look at some of the existing tests if you're unsure how to go about it. We're using coveralls that is an invaluable tools for seeing which parts of your code aren't being exercised by your tests.
-
Do your best to have well-formed commit messages for each change. This provides consistency throughout the project, and ensures that commit messages are able to be formatted properly by various git tools.
-
Finally, push the commits to your fork and submit a pull request. Please, remember to rebase properly in order to maintain a clean, linear git history.
See the LICENSE file for license rights and limitations (MIT).