### DMD with Time Delay, Specific SVD Rank, Exact, and Optimized Settings Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/dev-tutorial1.html This example demonstrates a comprehensive DMD setup including time delay, a specific SVD rank, exact computation, and optimized settings. ```python from pydmd import DMD import numpy as np # Create a dummy data matrix for demonstration nt = 50 # Number of time snapshots n = 100 # Number of spatial points X = np.random.rand(n, nt) # Initialize the DMD object with time delay, specific SVD rank, exact=True, and opt=True dmd = DMD(t_delay=3, svd_rank=5, exact=True, opt=True) # Compute the DMD modes dmd.fit(X) print("Optimal SVD Rank:", dmd.rank) print("DMD Modes shape:", dmd.modes.shape) print("Eigenvalues:", dmd.eigenvalues) print("Amplitudes:", dmd.amplitudes) ``` -------------------------------- ### DMD with Optimized Rank, Time Delay, Exact, and Optimized Settings Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/dev-tutorial1.html This example demonstrates a comprehensive DMD setup including optimized rank selection, time delay embedding, exact computation, and optimized settings. ```python from pydmd import DMD import numpy as np # Create a dummy data matrix for demonstration nt = 50 # Number of time snapshots n = 100 # Number of spatial points X = np.random.rand(n, nt) # Initialize the DMD object with optimal rank selection (svd_rank=0), time delay, exact=True, and opt=True dmd = DMD(svd_rank=0, t_delay=3, exact=True, opt=True) # Compute the DMD modes dmd.fit(X) print("Optimal SVD Rank:", dmd.rank) print("DMD Modes shape:", dmd.modes.shape) print("Eigenvalues:", dmd.eigenvalues) print("Amplitudes:", dmd.amplitudes) ``` -------------------------------- ### DMD with Input, Output, B, and C matrices (DMDc) Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial17edmd.html This example shows a full DMDc setup with explicit B and C matrices. ```python from pydmd import DMDc import numpy as np # Create random data x = np.random.rand(100, 10) y = np.random.rand(100, 10) u = np.random.rand(100, 2) # Control input B = np.random.rand(10, 2) # Input matrix C = np.random.rand(5, 10) # Output matrix # Initialize DMDc dmdc = DMDc() # Fit DMDc to data with explicit B and C matrices dmdc.fit(x, y, u, B=B, C=C) # Print results dmdc.print_modes() dmdc.print_eigenvalues() dmdc.print_ல்கள்() dmdc.print_amplitudes() ``` -------------------------------- ### DMD with Time Delay, Exact, and Optimized Rank Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/dev-tutorial1.html This example demonstrates a comprehensive DMD setup including time delay, exact computation, and optimized rank selection. ```python from pydmd import DMD import numpy as np # Create a dummy data matrix for demonstration nt = 50 # Number of time snapshots n = 100 # Number of spatial points X = np.random.rand(n, nt) # Initialize the DMD object with time delay, exact computation, and optimal rank dmd = DMD(exact=True, opt=True, t_delay=3) # Compute the DMD modes dmd.fit(X) print("Optimal SVD Rank:", dmd.rank) print("DMD Modes shape:", dmd.modes.shape) print("Eigenvalues:", dmd.eigenvalues) print("Amplitudes:", dmd.amplitudes) ``` -------------------------------- ### DMDPack Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial6hodmd.html Demonstrates the usage of DMDPack for a collection of DMD algorithms. ```python import numpy as np from pydmd import DMDPack # Create synthetic data t = np.linspace(0, 10, 200) X = np.sin(t) + 0.5 * np.sin(2*t) X = X.reshape(-1, 1) X1 = X[:-1] X2 = X[1:] # Initialize and run DMDPack dmd_pack = DMDPack() dmd_pack.fit(X1, X2) print(f'Available DMDs: {dmd_pack.dmds.keys()}') print(f'DMD (rank=1) eigenvalues: {dmd_pack.dmds["dmd"].eigs}') ``` -------------------------------- ### DMD with Specific SVD Rank, Time Delay, Exact, and Optimized Settings Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/dev-tutorial1.html This example demonstrates a comprehensive DMD setup including a specific SVD rank, time delay embedding, exact computation, and optimized settings. ```python from pydmd import DMD import numpy as np # Create a dummy data matrix for demonstration nt = 50 # Number of time snapshots n = 100 # Number of spatial points X = np.random.rand(n, nt) # Initialize the DMD object with a specific SVD rank, time delay, exact=True, and opt=True dmd = DMD(svd_rank=5, t_delay=3, exact=True, opt=True) # Compute the DMD modes dmd.fit(X) print("Optimal SVD Rank:", dmd.rank) print("DMD Modes shape:", dmd.modes.shape) print("Eigenvalues:", dmd.eigenvalues) print("Amplitudes:", dmd.amplitudes) ``` -------------------------------- ### DMDSpectrum Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial4cdmd.html Demonstrates how to use DMDSpectrum to analyze the spectral properties of the system. ```python import numpy as np from pydmd import DMDSpectrum # Create a synthetic dataset t = np.linspace(0, 10, 200) X = np.zeros((2, len(t))) X[0, :] = np.cos(t) X[1, :] = np.sin(t) # Add some noise X += 0.1 * np.random.randn(*X.shape) # Create a DMDSpectrum instance dmd_spectrum = DMDSpectrum(svd_rank=2) # Fit DMDSpectrum to the data dmd_spectrum.fit(X) # Plot the spectrum dmd_spectrum.plot_spectrum() plt.show() ``` -------------------------------- ### DMD Algorithm Parameters Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial15pidmd.html This example shows how to initialize DMD with various parameters like svd_rank, exact, and opt. ```python from pydmd import DMD import numpy as np # Create a synthetic dataset t = np.linspace(0, 10, 100) X = np.vstack([np.cos(t), np.sin(t)]) # Initialize DMD with specific parameters dmd_params = DMD(svd_rank=1, exact=True, opt=True) dmd_params.fit(X) print("DMD Modes (svd_rank=1, exact=True, opt=True):\n", dmd_params.modes) print("DMD Eigenvalues (svd_rank=1, exact=True, opt=True):\n", dmd_params.eigenvalues) ``` -------------------------------- ### Basic DMD Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial4cdmd.html A simple example demonstrating the core functionality of Dynamic Mode Decomposition. ```python import numpy as np import matplotlib.pyplot as plt from pydmd import DMD # Create a synthetic dataset t = np.linspace(0, 10, 200) X = np.zeros((2, len(t))) X[0, :] = np.cos(t) X[1, :] = np.sin(t) # Add some noise X += 0.1 * np.random.randn(*X.shape) # Create a DMD instance dmd = DMD(svd_rank=2) # Fit DMD to the data dmd.fit(X) # Plot the results dmd.plot_modes_and_atilde() plt.show() dmd.plot_reconstruction() plt.show() ``` -------------------------------- ### DMDPack Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial4cdmd.html Demonstrates the use of DMD with a package of basis functions, allowing for more complex dynamic mode analysis. ```python from pydmd import DMDPack import numpy as np # Create a synthetic dataset t = np.linspace(0, 10, 100) X1 = np.vstack((np.sin(t), np.cos(t))).T X2 = np.vstack((np.sin(t + 0.1), np.cos(t + 0.1))).T # Define a package of basis functions def basis_package(x): return np.hstack((x, x[:, 0:1]**2)) # Instantiate DMDPack dmd_pack = DMDPack(basis_functions=basis_package) # Fit DMDPack dmd_pack.fit(X1, X2) # Print results dmd_pack.print_summary() ``` -------------------------------- ### DMD with Pre-processing Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/dev-tutorial1.html This example shows how to apply pre-processing steps to the data before performing DMD, such as centering or scaling. ```python import numpy as np from pydmd import DMD from sklearn.preprocessing import StandardScaler # Create synthetic data t = np.linspace(0, 10, 100) X = np.vstack((np.cos(t), np.sin(t))) # Apply pre-processing (e.g., Standard Scaling) scaler = StandardScaler() X_scaled = scaler.fit_transform(X.T).T # Initialize and run DMD on scaled data dmd = DMD() dmd.fit(X_scaled) # Get results modes = dmd.modes eigenvalues = dmd.eigenvalues print("DMD Modes (with Pre-processing):\n", modes) print("Eigenvalues (with Pre-processing):\n", eigenvalues) ``` -------------------------------- ### VarPro Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial4cdmd.html Demonstrates the Variational Approximation (VarPro) method for DMD. ```python from pydmd import VarPro varpro = VarPro(svd_rank=0) varpro.fit(X) # VarPro is another approach to DMD, focusing on variational principles ``` -------------------------------- ### DMDRoot Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial15pidmd.html Demonstrates the use of DMDRoot for finding the roots of the DMD characteristic polynomial. ```python from pydmd import DMDRoot import numpy as np # Create a synthetic dataset x1 = np.array([1, 2, 3, 4, 5]) x2 = np.array([2, 3, 4, 5, 6]) X = np.vstack((x1, x2)) # Instantiate DMDRoot dmd = DMDRoot(svd_rank=1) dmd.fit(X) # Print the results dmd.print_modes() dmd.print_eigenvalues() dmd.print_timeline() ``` -------------------------------- ### Simple Algorithm Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/developershelp1.html This snippet demonstrates a basic application of the algorithm. It processes data and returns results. ```python 8Z/aTjvbINj0GYvqeKNbpWKV6UGqNg9epOKw/Y/kWC7yBakx4bjG55f4PEOx7Z4vEz7dsHn3h/ke76IW4bxuF/cMGCnUfoHixARERERERERERFRv9Fv7mQmIiIiKifeyUxERERE1Hf4vlmWF/9F/hx3J8WLzEREREQlwIvMRERERETUX/EiMxEREREREREREVEBX8pz00cffSQzn8lMREREVAq+dLyBulT/+uoAlIiIiIhoR1fqsX3HGN+QpUuXSkNDgzQ0NMi8efN6O6slwTuZiYiIiIiIiIiIiLaTKVOmyOLFi3s7GSXVby4y1yfaxU64IiKS8yw1LWZ4KnY9fYN3OmarOGcV3Fdk4D1G+jZ609VTTUfHVtYPjQ1Y3ocag6SLb8L24zA/rA+T78MXZkFe43ZOTau0syqusHXmTLj/Ku3qxBuwrZyr6yUX07FnQmLxFws4GcseYgvqonB+/DUErgv5Oqni2ThD+PI4g2npio1ZLsR6elRZIs/tyKBnQZsr8pcg2AbNXPh0LAssO6zXwHRPz2D4eoWBoi6Y3YS8WliO2MZwVZg2SAvuf35gfbgCmAplFdWGC+fHNos/U8F3FRjFtlFoY1hW2CbtGLRZExuCZsH6PChbM9axvGtiZgIdmY6xjUb0y6YDeQ30swJfhBe+h/1weFFAm9UzJ2J6B6uAfrgypjOD5Z71wvsGJ6enOzHdb7tWRD9cZFkXHvMsJ7wRetC3uIWzZyM72e2Cz2Qm2v4qDFsqjS0drwedkA2xhZ2StOc/pf1mNWWvirUq/qu3j4o3u8nQdNlwEE/AsarG1P2tDQcPCwYdLox3KuFgkjR0J2kabSpO2x0H/rGV6/S8a8ZJmEozo+JaiGsgrz3NmyPheRNJqajNSuj0WR31uvut/1HThpy4Wcex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K+ixeZiYiIiEqgnI/LKMbpp58u69atkyuuuEIaGxtl/Pjx8uc//zn/MsBVq1aJaXbcRbJp0yY5//zzpbGxUQYMGCATJ06UZ555RhoaGkqWDyIiIiKinY3nd++mj/6KF5mJiIiI+pgLL7ywy8djPPnkkyr+6U9/Kj/96U+3Q6qIiIiIiHYevpTpxX9leATHjoAXmYmIiIhKoBxvn+6rb54mIiIiIqK+hReZiYiIiIiIiIiIiAqU4yaSLest+Sp3CLzITERERFQCvpR+wNhHx59ERERERNTH9JuLzEPimyUZ35LdjGeHztvqJFWciOVUbJheQaCXNTyIXR2bWX26aKU9iPUChqfn92xLxb6pQnGzeroJ28f0IdPSM8RjHSuotrNqWr3druKqWCZ03TFITNbTza8ZynmzBafW+McjyIuZg9jRsZXR64uldVxY1p4V/pcqz9bTcduYNvzDlwF5i9t6BZVQ1rVxXbZxKEsPCsc09PpdTzeUdKxjH8hFlTNMxjZlZSGGcsb5kYtlZeoEGLC74j4VAOkvbNO4L1dAOSdhOv7FMmPqNuvCDug4MB3KNvAHUCx67C+c8Nhyur78FFWu2A3itqEJBS50mSb2FbrssL+ohv4B22jS0n0Xanc6Epy2deKxnFFkvwzlaGX1AgaWc6Df1+3Ah/S4yfD+wvD09 ``` -------------------------------- ### DMDPOD Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial15pidmd.html Demonstrates the use of DMDPOD for combining DMD with Proper Orthogonal Decomposition. ```python from pydmd import DMDPOD import numpy as np # Create a synthetic dataset x1 = np.array([1, 2, 3, 4, 5]) x2 = np.array([2, 3, 4, 5, 6]) X = np.vstack((x1, x2)) # Instantiate DMDPOD dmd = DMDPOD(svd_rank=1) dmd.fit(X) # Print the results dmd.print_modes() dmd.print_eigenvalues() dmd.print_timeline() ``` -------------------------------- ### Basic DMD Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial17edmd.html A simple example demonstrating the core functionality of PyDMD to perform Dynamic Mode Decomposition on a given dataset. Ensure you have numpy and pydmd installed. ```python import numpy as np from pydmd import DMD # Create a synthetic dataset x = np.linspace(0, 2 * np.pi, 100) y = np.sin(x) # Reshape for DMD (time steps x spatial points) data = np.vstack((y, y)).T # Example with two identical time series # Initialize and run DMD dmd = DMD() dmd.fit(data) # Print the eigenvalues print("Eigenvalues:", dmd.eigs) # Plot the results (optional) # dmd.plot_modes_2D() # dmd.plot_ல்கள்() ``` -------------------------------- ### DMD with Initial Conditions Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/dev-tutorial1.html This example shows how to provide initial conditions for the DMD analysis, which can influence the reconstruction of the system's dynamics. ```python import numpy as np from pydmd import DMD # Create synthetic data t = np.linspace(0, 10, 100) X = np.vstack((np.cos(t), np.sin(t))) # Define initial conditions initial_conditions = X[:, 0] # First time step # Initialize and run DMD with initial conditions dmd = DMD(icsv=initial_conditions) dmd.fit(X) # Get results modes = dmd.modes eigenvalues = dmd.eigenvalues print("DMD Modes (with Initial Conditions):\n", modes) print("Eigenvalues (with Initial Conditions):\n", eigenvalues) ``` -------------------------------- ### DMDSpectrum with custom parameters Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial4cdmd.html This example shows how to customize the DMDSpectrum plot, such as setting the frequency range and resolution. Ensure Matplotlib is installed. ```python import numpy as np from pydmd import DMD from pydmd.plotter import DMDSpectrum import matplotlib.pyplot as plt # Create a synthetic dataset x1 = np.array([1, 2, 3, 4, 5]) x2 = np.array([2, 3, 4, 5, 6]) X = np.vstack((x1, x2)) # Initialize and run DMD dmd = DMD() dmd.fit(X) # Plot the DMD spectrum with custom parameters spectrum = DMDSpectrum(dmd, time_range=10, log_scale=True) spectrum.plot_spectrum(title="Custom DMD Spectrum") plt.show() ``` -------------------------------- ### DMDRootFinding Example Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial17edmd.html Shows how to use the DMDRootFinding algorithm, which finds the roots of the DMD eigenvalues to reconstruct the system's dynamics. This method is particularly useful for systems with complex eigenvalues. ```python import numpy as np from pydmd import DMDRootFinding # Create a synthetic dataset t = np.linspace(0, 10, 100) X = np.vstack((np.sin(t), np.cos(t))) # Instantiate and run DMDRootFinding dmd_rf = DMDRootFinding(svd_rank=2) dmd_rf.fit(X) # Analyze the results ``` -------------------------------- ### Optimized DMD (OptDMD) in PyDMD Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial4cdmd.html This example demonstrates the use of Optimized DMD (OptDMD) from PyDMD. OptDMD aims to find the optimal time-delay for the DMD analysis. Ensure numpy and pydmd are installed. ```python import numpy as np from pydmd import OptDMD # Load data (replace with your actual data) X = np.load('data.npy') # Create an OptDMD instance opt_dmd = OptDMD() # Compute OptDMD opt_dmd.fit(X) # Get DMD modes and eigenvalues modes = opt_dmd.modes eigenvalues = opt_dmd.eigenvalues # Print results (optional) print("OptDMD Modes:", modes) print("Eigenvalues:", eigenvalues) ``` -------------------------------- ### Extended DMD (EDMD) with PyDMD Source: https://github.com/mathlab/pydmd/blob/master/docs/source/_tutorials/tutorial4cdmd.html This example shows how to use the Extended Dynamic Mode Decomposition (EDMD) from PyDMD. EDMD is useful for systems with non-linear dynamics. Ensure numpy and pydmd are installed. ```python import numpy as np from pydmd import EDMD # Load data (replace with your actual data) X = np.load('data.npy') # Create an EDMD instance edmd = EDMD() # Compute EDMD edmd.fit(X) # Get EDMD modes and eigenvalues modes = edmd.modes eigenvalues = edmd.eigenvalues # Print results (optional) print("EDMD Modes:", modes) print("Eigenvalues:", eigenvalues) ```