Home

Awesome

<p align="center"> <a href="http://pydmd.github.io/PyDMD/" target="_blank" > <img alt="Python Dynamic Mode Decomposition" src="readme/logo_PyDMD.png" width="200" /> </a> </p> <p align="center"> <a href="http://pydmd.github.io/PyDMD" target="_blank"> <img alt="Docs" src="https://img.shields.io/badge/PyDMD-docs-blue?style=for-the-badge"/> </a> <a href="https://doi.org/10.21105/joss.00530" target="_blank"> <img alt="JOSS DOI" src="https://img.shields.io/badge/JOSS-10.21105/joss.00530-blue?style=for-the-badge"> </a> <a href="https://github.com/PyDMD/PyDMD/blob/master/LICENSE" target="_blank"> <img alt="Software License" src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=for-the-badge"> </a> <a href="https://pypi.org/project/pydmd/" target="_blank"> <img alt="PyPI version" src="https://img.shields.io/pypi/v/pydmd?style=for-the-badge"> </a> <br> <a href="https://github.com/PyDMD/PyDMD/actions/workflows/deploy_after_push.yml" target="_blank"> <img alt="CI Status" src="https://img.shields.io/github/actions/workflow/status/PyDMD/PyDMD/deploy_after_push.yml?style=for-the-badge"> </a> <a href="https://www.codacy.com/gh/PyDMD/PyDMD/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=PyDMD/PyDMD&amp;utm_campaign=Badge_Coverage" target="_blank"> <img src="https://img.shields.io/codacy/coverage/3d8b278a835e402c86cac9625bb4912f/master?style=for-the-badge"/> </a> <a href="https://app.codacy.com/gh/PyDMD/PyDMD/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade" target="_blank"> <img alt="Codacy Badge" src="https://img.shields.io/codacy/grade/3d8b278a835e402c86cac9625bb4912f?style=for-the-badge"/> </a> <a href="https://github.com/ambv/black" target="_blank"> <img alt="black code style" src="https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge"/> </a> <br> <a href="#developers-and-contributors"> <img alt="All Contributors" src="https://img.shields.io/badge/all_contributors-25-orange.svg?style=for-the-badge"/> </a> <a href="#stargazers"> <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/PyDMD/PyDMD?style=for-the-badge"> </a> </p>

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.

<p align="center"> <img src="readme/pydmd_capabilities.svg" width="1000" /> </p>

Dependencies and installation

Installing via PIP

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

> pip install pydmd

Installing from source

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

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

and then install the package in development mode:

> 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.

Examples and Tutorials

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.

<p align="center"> <img src="readme/dmd-example.png" alt> <em>The original snapshots used as input for the dynamic mode decomposition</em> </p> <p align="center"> <img src="readme/dmd-example.gif" alt></br> <em>The system evolution reconstructed with dynamic mode decomposition</em> </p>

Using PyDMD

To perform DMD, simply begin by initializing a PyDMD module that implements your DMD method of choice. Here, we demonstrate how a user might build a customized BOP-DMD model. 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.

from pydmd import BOPDMD
from pydmd.plotter import plot_summary

# Build a bagging, optimized DMD (BOP-DMD) model.
dmd = BOPDMD(
    svd_rank=15,  # rank of the DMD fit
    num_trials=100,  # number of bagging trials to perform
    trial_size=0.5,  # use 50% of the total number of snapshots per trial
    eig_constraints={"imag", "conjugate_pairs"},  # constrain the eigenvalue structure
    varpro_opts_dict={"tol":0.2, "verbose":True},  # set variable projection parameters
)

# Fit the DMD model.
# X = (n, m) numpy array of time-varying snapshot data
# t = (m,) numpy array of times of data collection
dmd.fit(X, t)

# Display a summary of the DMD results.
plot_summary(dmd)

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

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.

<p align="center"> <img src="readme/pydmd_guide.svg" width="1000" /> </p>

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.

References

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

General DMD References

DMD Variants: Noise-robust Methods

DMD Variants: Additional Methods and Extensions

Implementation Tools and Preprocessing

Recent works using PyDMD

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

Developers and contributors

The main developers are

<p align="center"> <img src="readme/main_developers.png" width="800" /> </p>

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!

<a href="https://github.com/PyDMD/PyDMD/graphs/contributors"> <img src="https://contrib.rocks/image?repo=PyDMD/PyDMD" /> </a>

Made with contrib.rocks.

Testing

We use pytest to run our unit tests. You can run the whole test suite by using the following command in the base directory of the repository:

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:

<p align="center"> <img src="readme/logos_funding.png" width="800" /> </p>