PyDMD

PyDMD: Python Dynamic Mode Decomposition - Published in JOSS (2018)

https://github.com/mathlab/pydmd

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 54 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: arxiv.org, scholar.google
  • Committers with academic emails
    7 of 36 committers (19.4%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords from Contributors

autoencoder data-driven pde reduced-basis proper-orthogonal-decomposition pod-nn pod-interpolation pod-gpr non-intrusive-model-order-reduction model-reduction

Scientific Fields

Artificial Intelligence and Machine Learning Computer Science - 69% confidence
Engineering Computer Science - 44% confidence
Mathematics Computer Science - 42% confidence
Last synced: 4 months ago · JSON representation

Repository

mathLab mirror of Python Dynamic Mode Decomposition

Basic Info
Statistics
  • Stars: 102
  • Watchers: 2
  • Forks: 9
  • Open Issues: 0
  • Releases: 0
Fork of PyDMD/PyDMD
Created over 2 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Zenodo

README.md

Python Dynamic Mode Decomposition

Docs PyPI version Python versions Software License
CI Status Codacy Badge black code style
All Contributors GitHub Repo stars PyPI downloads per month JOSS DOI

Table of contents

Description

PyDMD is a Python package designed for Dynamic Mode Decomposition (DMD), a data-driven method used for analyzing and extracting spatiotemporal coherent structures from time-varying datasets. It provides a comprehensive and user-friendly interface for performing DMD analysis, making it a valuable tool for researchers, engineers, and data scientists working in various fields.

With PyDMD, users can easily decompose complex, high-dimensional datasets into a set of coherent spatial and temporal modes, capturing the underlying dynamics and extracting important features. The package implements both standard DMD algorithms and advanced variations, enabling users to choose the most suitable method for their specific needs. These extensions allow to deal with noisy data, big dataset, control variables, or to impose physical structures.

PyDMD offers a seamless integration with the scientific Python ecosystem, leveraging popular libraries such as NumPy and SciPy for efficient numerical computations and data manipulation. It also offers a variety of visualization tools, including mode reconstruction, energy spectrum analysis, and time evolution plotting. These capabilities enable users to gain insights into the dominant modes of the system, identify significant features, and understand the temporal evolution of the dynamics.

PyDMD promotes ease of use and customization, providing a well-documented API with intuitive function names and clear parameter descriptions. The package is actively maintained and updated, ensuring compatibility with the latest Python versions and incorporating user feedback to improve functionality and performance. We provide many tutorials showing the characteristics of the software. See the Examples section below and the Tutorials to have an idea of the potential of this package. Also see the diagram below for a summary of all available tools and functionalities. Currently in-progress contributions are represented by semi-transparent boxes.

Dependencies and installation

Installing via PIP

PyDMD is available on PyPI, therefore you can install the latest released version with: ```bash

pip install pydmd ```

Installing from source

To install the bleeding edge version, clone this repository with: ```bash

git clone https://github.com/PyDMD/PyDMD ```

and then install the package in development mode: ```bash

pip install -e . ```

Dependencies

The core features of PyDMD depend on numpy and scipy. In order to use the plotting functionalities you will also need matplotlib.

Quickstart Guide

To perform DMD, simply begin by initializing a PyDMD module that implements your DMD method of choice. Models may then be fitted by calling the fit() method and passing in the necessary data. This step performs the DMD algorithm, after which users may use PyDMD plotting tools in order to visualize their results.

```python3 from pydmd import DMD from pydmd.plotter import plot_summary

Build an exact DMD model with 12 spatiotemporal modes.

dmd = DMD(svd_rank=12)

Fit the DMD model.

X = (n, m) numpy array of time-varying snapshot data.

dmd.fit(X)

Plot a summary of the key spatiotemporal modes.

plot_summary(dmd) ```

PyDMD modules can also be wrapped with data preprocessors if desired. These wrappers will preprocess the data and postprocess data reconstructions automatically. ```python3 from pydmd import DMD from pydmd.preprocessing import zeromeanpreprocessing

Build and fit an exact DMD model with data centering.

centereddmd = zeromeanpreprocessing(DMD(svdrank=12)) centered_dmd.fit(X) ```

Users may also build highly complex DMD models with PyDMD. Below is an example of how one might build and fit a customized Optimized DMD model with bagging, eigenvalue constraints, and custom variable projection arguments. ```python3 from pydmd import BOPDMD

Build a Bagging, Optimized DMD (BOP-DMD) model.

For Optimized DMD (without bagging), use BOPDMD(svdrank=12, numtrials=0).

bopdmd = BOPDMD( svdrank=12, # Rank of the DMD fit. numtrials=100, # Number of bagging trials to perform. trialsize=0.5, # Use 50% of the total number of snapshots per trial. eigconstraints={"imag", "conjugatepairs"}, # Eigenvalues must be imaginary and conjugate pairs. varproopts_dict={"tol":0.2, "verbose":True}, # Set convergence tolerance and use verbose updates. )

Fit the BOP-DMD model.

X = (n, m) numpy array of time-varying snapshot data

t = (m,) numpy array of times of data collection

bopdmd.fit(X, t) ```

PyDMD modules and functions may be parameterized by a variety of inputs for added customization, so we generally recommend that new users refer to our documentation, as well as to our module-specific tutorials for more examples and information.

Also provided below is an example call to the plot_summary() function when given a DMD model fitted to mean-centered flow past a cylinder data available at dmdbook.com/DATA.zip. A rank-12 exact DMD model was used to generate this figure. Eigenvalues, modes, and dynamics are color-coded to indicate associations. Eigenvalue marker sizes also indicate spatiotemporal mode amplitudes or importance.

Plotting tool documentation can be found here. ```python3 from pydmd.plotter import plot_summary

plotsummary( dmd, # <-- Fitted PyDMD model. Can be DMD, BOPDMD, etc. figsize=(12, 7), indexmodes=(0, 2, 4), snapshotsshape=(449, 199), order="F", modecmap="seismic", dynamicscolor="k", flipcontinuousaxes=True, maxsvalplot=30, ) ```


Sample output of the plotsummary function.

For users who are unsure of which DMD method is best for them, we provide the following flow chart, which outlines how one might choose an appropriate DMD variant based on specific problem types or data sets.

Awards

First prize winner in DSWeb 2019 Contest Tutorials on Dynamical Systems Software (Junior Faculty Category). You can read the winner tutorial (PDF format) in the tutorials folder.

Citing PyDMD

When citing PyDMD, please cite both of the following references: * Demo, Tezzele, Rozza. PyDMD: Python Dynamic Mode Decomposition. Journal of Open Source Software, 2018. [DOI][bibitem] * Ichinaga, Andreuzzi, Demo, Tezzele, Lapo, Rozza, Brunton, Kutz. PyDMD: A Python package for robust dynamic mode decomposition. arXiv preprint, 2024. [arXiv]

References

To implement the various versions of the DMD algorithm we follow these works:

General DMD References

  • Kutz, Brunton, Brunton, Proctor. Dynamic Mode Decomposition: Data-Driven Modeling of Complex Systems. SIAM Other Titles in Applied Mathematics, 2016. [DOI] [bibitem].
  • Schmid. Dynamic mode decomposition of numerical and experimental data. Journal of Fluid Mechanics, 2010. [DOI][bibitem]
  • Tu, Rowley, Luchtenburg, Brunton, Kutz. On Dynamic Mode Decomposition: Theory and Applications. Journal of Computational Dynamics, 2014. [DOI][bibitem]
  • Schmid. Dynamic mode decomposition and its variants. Annual Review of Fluid Mechanics, 2022. [DOI][bibitem]

DMD Variants: Noise-robust Methods

  • Forward-backward DMD: Dawson, Hemati, Williams, Rowley. Characterizing and correcting for the effect of sensor noise in the dynamic mode decomposition. Experiments in Fluids, 2016. [DOI] [bibitem].
  • Total least-squares DMD: 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] [bibitem].
  • Optimal closed-form DMD: Has, Herzet. Low-rank dynamic mode decomposition: An exact and tractable solution. Journal of Nonlinear Science, 2022. [DOI] [bibitem].
  • Subspace DMD: Takeishi, Kawahara, Yairi. Subspace dynamic mode decomposition for stochastic Koopman analysis. Physical Review E, 2017. [DOI] [bibitem].
  • Physics-informed DMD: Baddoo, Herrmann, McKeon, Kutz, Brunton. Physics-informed dynamic mode decomposition. Proceedings of the Royal Society A, 2023. [DOI] [bibitem].
  • Optimized DMD: Askham, Kutz. Variable projection methods for an optimized dynamic mode decomposition. SIAM Journal on Applied Dynamical Systems, 2018. [DOI] [bibitem].
  • Bagging, optimized DMD: Sashidhar, Kutz. Bagging, optimized dynamic mode decomposition for robust, stable forecasting with spatial and temporal uncertainty quantification. Proceedings of the Royal Society A, 2022. [DOI] [bibitem].

DMD Variants: Additional Methods and Extensions

  • DMD with Control: Proctor, Brunton, Kutz. Dynamic mode decomposition with control. SIAM Journal on Applied Dynamical Systems, 2016. [DOI] [bibitem].
  • Multiresolution DMD: Kutz, Fu, Brunton. Multiresolution dynamic mode decomposition. SIAM Journal on Applied Dynamical Systems, 2016. [DOI] [bibitem].
  • Sparsity-promoting DMD: Jovanovi, Schmid, Nichols Sparsity-promoting dynamic mode decomposition. Physics of Fluids, 2014. [DOI] [bibitem].
  • Compressed DMD: Erichson, Brunton, Kutz. Compressed dynamic mode decomposition for background modeling. Journal of Real-Time Image Processing, 2016. [DOI] [bibitem].
  • Randomized DMD: Erichson, Mathelin, Kutz, Brunton. Randomized dynamic mode decomposition. SIAM Journal on Applied Dynamical Systems, 2019. [DOI] [bibitem].
  • Higher Order DMD: Le Clainche, Vega. Higher order dynamic mode decomposition. Journal on Applied Dynamical Systems, 2017. [DOI] [bibitem].
  • HAVOK: Brunton, Brunton, Proctor, Kaiser, Kutz. Chaos as an intermittently forced linear system. Nature Communications, 2017. [DOI] [bibitem].
  • Parametric DMD: Andreuzzi, Demo, Rozza. A dynamic mode decomposition extension for the forecasting of parametric dynamical systems. SIAM Journal on Applied Dynamical Systems, 2023. [DOI] [bibitem].
  • Extended DMD: Williams, Rowley, Kevrekidis. A kernel-based method for data-driven koopman spectral analysis. Journal of Computational Dynamics, 2015. [DOI] [bibitem].
  • LANDO: Baddoo, Herrmann, McKeon, Brunton. Kernel learning for robust dynamic mode decomposition: linear and nonlinear disambiguation optimization. Proceedings of the Royal Society A, 2022. [DOI] [bibitem].
  • DMD with Centering: Hirsh, Harris, Kutz, Brunton. Centering data improves the dynamic mode decomposition. SIAM Journal on Applied Dynamical Systems, 2020. [DOI] [bibitem]

General Implementation Tools

  • Gavish, Donoho. The optimal hard threshold for singular values is 4/sqrt(3). IEEE Transactions on Information Theory, 2014. [DOI] [bibitem].
  • Matsumoto, Indinger. On-the-fly algorithm for dynamic mode decomposition using incremental singular value decomposition and total least squares. 2017. [arXiv] [bibitem].

Recent works using PyDMD

You can find a list of the scientific works using PyDMD here.

Developers and contributors

The main developers are

We warmly thank all the contributors that have supported PyDMD!

Do you want to join the team? Read the Contributing guidelines and the Tutorials for Developers before starting to play!

Made with contrib.rocks.

Testing

We use pytest to run our unit tests. Use the following command to install the dependencies required to test a local clone of PyDMD (assuming the relative path of the repository to be ./PyDMD/): bash python -m pip install PyDMD/[test]

You can run the whole test suite by using the following command in the base directory of the repository: bash python -m pytest

Funding

A significant part of PyDMD has been written either as a by-product for other projects people were funded for, or by people on university-funded positions. There are probably many of such projects that have led to some development of PyDMD. We are very grateful for this support!

Beyond this, PyDMD has also been supported by some dedicated projects that have allowed us to work on extensions, documentation, training and dissemination that would otherwise not have been possible. In particular, we acknowledge the following sources of support with great gratitude:

Affiliations

Owner

  • Name: SISSA mathLab
  • Login: mathLab
  • Kind: organization
  • Email: luca.heltai@sissa.it
  • Location: Via Bonomea 265, 34133 Trieste, TS, Italy

Applied Mathematics Laboratory @ SISSA

JOSS Publication

PyDMD: Python Dynamic Mode Decomposition
Published
February 12, 2018
Volume 3, Issue 22, Page 530
Authors
Nicola Demo ORCID
Internation School of Advanced Studies, SISSA, Trieste, Italy
Marco Tezzele ORCID
Internation School of Advanced Studies, SISSA, Trieste, Italy
Gianluigi Rozza ORCID
Internation School of Advanced Studies, SISSA, Trieste, Italy
Editor
Jake Vanderplas ORCID
Tags
Dynamic mode decomposition DMD Multiresolution DMD Compressed DMD Forward Backward DMD

GitHub Events

Total
  • Watch event: 21
  • Push event: 1
  • Fork event: 1
Last Year
  • Watch event: 21
  • Push event: 1
  • Fork event: 1

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 1,019
  • Total Committers: 36
  • Avg Commits per committer: 28.306
  • Development Distribution Score (DDS): 0.674
Past Year
  • Commits: 44
  • Committers: 6
  • Avg Commits per committer: 7.333
  • Development Distribution Score (DDS): 0.386
Top Committers
Name Email Commits
Sara m****9@g****m 332
Francesco Andreuzzi a****o@g****m 260
Nicola Demo d****a@g****m 160
Marco Tezzele m****z@g****m 99
klapo l****l@g****m 40
David Salvador Jasin d****n@t****k 27
Gerhard Reinerth g****h@t****e 24
Azzeddine TIBA a****a@g****m 15
nmank n****h@g****m 5
Luka Karlić 7****a 4
Federico Pichi f****i@s****t 4
Takaya Uchida t****a@m****u 4
Maria Strazzullo m****u@s****t 4
Josh Myers-Dean j****h@e****u 4
Renato Miotto f****1@n****u 3
Donadini Eleonora 4****i 3
github-actions[bot] 4****] 3
mgirfogl m****l@s****t 3
Adam Li a****2@g****m 2
Brad Nolan 3****d 2
Doublonmousse 1****e 2
Mathias Schmitt m****t@g****m 2
Ruben Fernandez 6****6 2
Xiangmin Jiao x****o@s****u 2
Leonardo Scandurra s****r@h****e 2
Arfon Smith a****n 1
Daniel Lehmberg d****g@h****u 1
Ilya i****v@r****u 1
Jean-Christophe l****c@g****m 1
Shervin Sahba s****a@g****m 1
and 6 more...

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 0
  • Total pull requests: 10
  • Average time to close issues: N/A
  • Average time to close pull requests: 22 days
  • Total issue authors: 0
  • Total pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • ndem0 (5)
  • github-actions[bot] (1)
  • NolanBrad (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/deploy_after_push.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/deploy_after_tag.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • ncipollo/release-action v1 composite
  • peaceiris/actions-gh-pages v4 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/export_tutorials.yml actions
  • FedericoCarboni/setup-ffmpeg v2 composite
  • actions/cache v2 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • benjlevesque/short-sha v2.1 composite
  • jitterbit/get-changed-files v1 composite
  • peter-evans/create-pull-request v5.0.2 composite
.github/workflows/monthly-tag.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/testing_pr.yml actions
  • FedericoCarboni/setup-ffmpeg v3.1 composite
  • actions/cache v2 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
pyproject.toml pypi
  • h5netcdf *
  • matplotlib *
  • numpy *
  • scikit-learn *
  • scipy >=1.6.0
  • typing_extensions >=4.7.0;python_version<'3.12'
  • xarray *