Skip to content

Commit 5cf446c

Browse files
committed
Updated tutorial 1
1 parent dd8a431 commit 5cf446c

File tree

5 files changed

+451
-228
lines changed

5 files changed

+451
-228
lines changed

pydmd/bopdmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def compute_operator(self, H, t):
748748
"Consider re-adjusting your variable projection parameters "
749749
"with the varpro_opts_dict and consider setting verbose=True."
750750
)
751-
print(msg)
751+
warnings.warn(msg)
752752

753753
# If num_trials isn't a positive int, perform standard optimized dmd.
754754
if self._num_trials <= 0 or not isinstance(self._num_trials, int):

pydmd/plotter.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ def plot_snapshots_2D(
535535
def plot_summary(
536536
dmd,
537537
*,
538+
d=1,
538539
continuous=False,
539540
snapshots_shape=None,
540541
index_modes=None,
@@ -567,6 +568,8 @@ def plot_summary(
567568
568569
:param dmd: DMD instance.
569570
:type dmd: pydmd.DMDBase
571+
:param d: Number of delays applied to the data passed to the DMD instance.
572+
:type d: int
570573
:param continuous: Whether or not the eigenvalues of the given DMD instance
571574
are continuous-time. If `False`, the eigenvalues are assumed to be the
572575
discrete-time eigenvalues. If `True`, the eigenvalues are taken to be
@@ -715,6 +718,15 @@ def plot_summary(
715718
disc_eigs = lead_eigs
716719
cont_eigs = np.log(lead_eigs) / dt
717720

721+
# Get mode averages across delays if time-delay was used.
722+
if d > 1:
723+
lead_modes = np.average(
724+
lead_modes.reshape(
725+
d, lead_modes.shape[0] // d, lead_modes.shape[1]
726+
),
727+
axis=0,
728+
)
729+
718730
# Compute the singular values of the data matrix.
719731
if isinstance(dmd, HankelDMD):
720732
# Use time-delay data matrix to compute singular values.

tutorials/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ An additional PDF tutorial ([DSWeb contest winner](https://dsweb.siam.org/The-Ma
66

77
| Name | Description | PyDMD used classes |
88
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|-----------------------|
9-
| Tutorial1&#160;[[.ipynb](tutorial1/tutorial-1-dmd.ipynb),&#160;[.py](tutorial1/tutorial-1-dmd.py),&#160;[.html](http://pydmd.github.io/PyDMD/tutorial1dmd.html)] | basic usage of standard DMD | `pydmd.DMD` |
9+
| Tutorial1&#160;[[.ipynb](tutorial1/tutorial-1-dmd.ipynb),&#160;[.py](tutorial1/tutorial-1-dmd.py),&#160;[.html](http://pydmd.github.io/PyDMD/tutorial1dmd.html)] | Analyzing real, simple data sets with PyDMD | `pydmd.DMD`, `pydmd.BOPDMD` |
1010
| Tutorial2&#160;[[.ipynb](tutorial2/tutorial-2-adv-dmd.ipynb),&#160;[.py](tutorial2/tutorial-2-adv-dmd.py),&#160;[.html](http://pydmd.github.io/PyDMD/tutorial2advdmd.html)] | advanced features of standard DMD | `pydmd.DMD` |
1111
| Tutorial3&#160;[[.ipynb](tutorial3/tutorial-3-mrdmd.ipynb),&#160;[.py](tutorial3/tutorial-3-mrdmd.py),&#160;[.html](http://pydmd.github.io/PyDMD/tutorial3mrdmd.html)] | multi-resolution DMD for transient phenomena | `pydmd.MrDMD` |
1212
| Tutorial4&#160;[[.ipynb](tutorial4/tutorial-4-cdmd.ipynb),&#160;[.py](tutorial4/tutorial-4-cdmd.py),&#160;[.html](http://pydmd.github.io/PyDMD/tutorial4cdmd.html)] | compress DMD for computation speedup | `pydmd.CDMD` |

tutorials/tutorial1/tutorial-1-dmd.ipynb

100755100644
Lines changed: 437 additions & 81 deletions
Large diffs are not rendered by default.

tutorials/tutorial1/tutorial-1-dmd.py

Lines changed: 0 additions & 145 deletions
This file was deleted.

0 commit comments

Comments
 (0)