Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_partial_dynamics1(self):
max_level = 5
level = 2
rank = 2
dmd = MrDMD(svd_rank=rank, max_level=max_level, max_cycles=2)
dmd.fit(X=sample_data)
pdynamics = dmd.partial_dynamics(level)
assert pdynamics.shape == (2**level * rank, sample_data.shape[1])
def test_shape_modes(self):
level = 5
dmd = MrDMD(svd_rank=1, max_level=level, max_cycles=2)
dmd.fit(X=sample_data)
assert dmd.modes.shape == (sample_data.shape[0], 2**level - 1)
def test_partial_eigs2(self):
max_level = 5
level = 2
rank = 2
dmd = MrDMD(svd_rank=rank, max_level=max_level, max_cycles=2)
dmd.fit(X=sample_data)
peigs = dmd.partial_eigs(level, 3)
assert peigs.shape == (rank, )
def test_partial_eigs1(self):
max_level = 5
level = 2
rank = 2
dmd = MrDMD(svd_rank=rank, max_level=max_level, max_cycles=2)
dmd.fit(X=sample_data)
peigs = dmd.partial_eigs(level)
assert peigs.shape == (rank * 2**level, )
def test_plot_eig3(self):
dmd = MrDMD(svd_rank=-1, max_level=7, max_cycles=1)
dmd.fit(X=sample_data)
dmd.plot_eigs(show_axes=False, show_unit_circle=False, level=1, node=0)
plt.close()
def test_partial_reconstructed2(self):
max_level = 5
level = 2
rank = 2
dmd = MrDMD(svd_rank=rank, max_level=max_level, max_cycles=2)
dmd.fit(X=sample_data)
pdata = dmd.partial_reconstructed_data(level, 3)
assert pdata.shape == (sample_data.shape[0], old_div(
sample_data.shape[1], 2**level))
def test_partial_dynamics2(self):
max_level = 5
level = 2
rank = 2
dmd = MrDMD(svd_rank=rank, max_level=max_level, max_cycles=2)
dmd.fit(X=sample_data)
pdynamics = dmd.partial_dynamics(level, 3)
assert pdynamics.shape == (rank, old_div(sample_data.shape[1], 2**level)
)
def test_time_window_growth_rate(self):
level = 3
dmd = MrDMD(svd_rank=1, max_level=level, max_cycles=2)
dmd.fit(X=sample_data)
assert len(dmd.time_window_growth_rate(0, dmd._snapshots.shape[1])) == 7
def test_partial_time_interval2(self):
level = 4
dmd = MrDMD(svd_rank=1, max_level=level, max_cycles=2)
dmd.original_time = {'t0': 0, 'tend': 8, 'dt': 1}
with self.assertRaises(ValueError):
dmd.partial_time_interval(4, 0)
def test_wrong_plot_eig2(self):
dmd = MrDMD(svd_rank=1, max_level=7, max_cycles=1)
with self.assertRaises(ValueError):
dmd.plot_eigs()