Skip to content

Commit c8b8013

Browse files
authored
Merge pull request PyDMD#465 from sichinaga/new-module/no-ref/lando
New module: LANDO (plus minor updates)
2 parents ec4e18d + e582572 commit c8b8013

File tree

8 files changed

+2293
-7
lines changed

8 files changed

+2293
-7
lines changed

pydmd/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"bopdmd",
1717
"pidmd",
1818
"edmd",
19+
"lando",
1920
]
2021

2122

@@ -30,6 +31,7 @@
3031
from .hankeldmd import HankelDMD
3132
from .havok import HAVOK
3233
from .hodmd import HODMD
34+
from .lando import LANDO
3335
from .meta import *
3436
from .mrdmd import MrDMD
3537
from .optdmd import OptDMD

pydmd/bopdmd.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def __init__(
149149
self._eig_constraints = eig_constraints
150150
self._bag_warning = bag_warning
151151
self._bag_maxfail = bag_maxfail
152-
self._varpro_opts = (
152+
self._varpro_opts = [
153153
init_lambda,
154154
maxlam,
155155
lamup,
@@ -159,7 +159,7 @@ def __init__(
159159
eps_stall,
160160
use_fulljac,
161161
verbose,
162-
)
162+
]
163163
self._varpro_opts_warn()
164164

165165
self._modes = None
@@ -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-
warnings.warn(msg)
751+
print(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):
@@ -759,6 +759,12 @@ def compute_operator(self, H, t):
759759
return b_0
760760

761761
# Otherwise, perform BOP-DMD.
762+
verbose = self._varpro_opts[-1]
763+
if verbose:
764+
num_trial_print = 5
765+
msg = "\nDisplaying the results of the next {} trials...\n"
766+
print(msg.format(num_trial_print))
767+
762768
# Initialize storage for values needed for stat computations.
763769
w_sum = np.zeros(w_0.shape, dtype="complex")
764770
e_sum = np.zeros(e_0.shape, dtype="complex")
@@ -778,6 +784,11 @@ def compute_operator(self, H, t):
778784
H_i, t[subset_inds], e_0
779785
)
780786
w_i, e_i, b_i, _, _, converged = trial_optdmd_results
787+
if verbose:
788+
print()
789+
num_trial_print -= 1
790+
verbose = num_trial_print > 0
791+
self._varpro_opts[-1] = verbose
781792

782793
# Incorporate results into the running average
783794
# ONLY IF the trial successfully converged.
@@ -810,7 +821,7 @@ def compute_operator(self, H, t):
810821
"Consider loosening the tol requirements "
811822
"of the variable projection routine."
812823
)
813-
warnings.warn(msg.format(num_consecutive_fails))
824+
print(msg.format(num_consecutive_fails))
814825
runtime_warning_given = True
815826

816827
elif num_consecutive_fails == self._bag_maxfail:

0 commit comments

Comments
 (0)