Skip to content

Commit 6f4d59d

Browse files
nmankmtezzele
authored andcommitted
black tests passed
1 parent faad402 commit 6f4d59d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

pydmd/dmdc.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,14 @@ class DMDc(DMDBase):
191191
equal than `svd_rank`. For the possible values please refer to the
192192
`svd_rank` parameter description above.
193193
:type svd_rank_omega: int or float
194-
:param lag: the time lag for the snapshots. Used in fit method to generate
194+
:param lag: the time lag for the snapshots. Used in fit method to generate
195195
X and Y.
196196
:type lag: int
197197
"""
198198

199-
def __init__(self, svd_rank=0, tlsq_rank=0, opt=False, svd_rank_omega=-1, lag=1):
199+
def __init__(
200+
self, svd_rank=0, tlsq_rank=0, opt=False, svd_rank_omega=-1, lag=1
201+
):
200202
# we're going to initialize Atilde when we know if B is known
201203
self._Atilde = None
202204
# remember the arguments for when we'll need them
@@ -309,12 +311,10 @@ def fit(self, X, I, B=None):
309311
n_samples = self.snapshots.shape[-1]
310312

311313
if self._lag < 1:
312-
raise ValueError(
313-
"Time lag must be positive."
314-
)
315-
316-
X = self.snapshots[:, :-self._lag]
317-
Y = self.snapshots[:, self._lag:]
314+
raise ValueError("Time lag must be positive.")
315+
316+
X = self.snapshots[:, : -self._lag]
317+
Y = self.snapshots[:, self._lag :]
318318

319319
self._set_initial_time_dictionary(
320320
{"t0": 0, "tend": n_samples - 1, "dt": 1}

tests/test_dmdc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def create_system_without_B_lag(lag=1):
3434
snapshots = []
3535
for _ in range(lag):
3636
snapshots.append(np.array([0.25] * n))
37-
u = np.random.rand(n, m-lag) - 0.5
38-
for i in range(m-lag):
37+
u = np.random.rand(n, m - lag) - 0.5
38+
for i in range(m - lag):
3939
snapshots.append(A.dot(snapshots[i]) + B.dot(u[:, i]))
4040
snapshots = np.array(snapshots).T
4141
return {"snapshots": snapshots, "u": u, "B": B, "A": A}
@@ -106,7 +106,7 @@ def test_reconstruct_b_unknown():
106106

107107
def test_reconstruct_b_unknown_lag():
108108
lag = 3
109-
system = create_system_without_B_lag(lag = lag)
109+
system = create_system_without_B_lag(lag=lag)
110110
dmdc = DMDc(svd_rank=-1, opt=True, lag=lag)
111111
dmdc.fit(system["snapshots"], system["u"])
112112
np.testing.assert_array_almost_equal(
@@ -276,7 +276,7 @@ def test_correct_amplitudes():
276276

277277

278278
def test_lag_param_b_unknown_raises():
279-
system = create_system_without_B_lag(lag = 3)
279+
system = create_system_without_B_lag(lag=3)
280280
dmdc = DMDc(svd_rank=-1, opt=True, lag=0)
281281
with raises(ValueError):
282-
dmdc.fit(system["snapshots"], system["u"])
282+
dmdc.fit(system["snapshots"], system["u"])

0 commit comments

Comments
 (0)