Skip to content

Commit 29a28cf

Browse files
committed
Fix indexing bug
1 parent c486dd5 commit 29a28cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pydmd/plotter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,6 @@ def plot_summary(
690690
if rank > max_sval_plot:
691691
raise ValueError(f"max_sval_plot must be at least {rank}.")
692692

693-
# Indices cannot go past the total number of available modes.
694-
if np.any(np.array(index_modes) >= rank):
695-
raise ValueError(f"Cannot view past mode {rank}.")
696-
697693
# Override index_modes if there are less than 3 modes available.
698694
if rank < 3:
699695
warnings.warn(
@@ -702,6 +698,10 @@ def plot_summary(
702698
)
703699
index_modes = np.arange(rank)
704700

701+
# Indices cannot go past the total number of available modes.
702+
if np.any(np.array(index_modes) >= rank):
703+
raise ValueError(f"Cannot view past mode {rank}.")
704+
705705
# Sort eigenvalues, modes, and dynamics according to amplitude magnitude.
706706
mode_order = np.argsort(-np.abs(dmd.amplitudes))
707707
lead_eigs = dmd.eigs[mode_order]

0 commit comments

Comments
 (0)