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_truncation_shape(self):
dmd = DMD(svd_rank=3)
dmd.fit(X=sample_data)
assert dmd.modes.shape[1] == 3
def test_dynamics_opt_1(self):
dmd = DMD(svd_rank=5, opt=True)
dmd.fit(X=sample_data)
assert dmd.dynamics.shape == (5, sample_data.shape[1])
def test_plot_modes_5(self):
dmd = DMD()
snapshots = [snap.reshape(20, 20) for snap in sample_data.T]
dmd.fit(X=snapshots)
dmd.plot_modes_2D(index_mode=1, filename='tmp.png')
self.addCleanup(os.remove, 'tmp.1.png')
def test_dmd_time_3(self):
dmd = DMD()
dmd.fit(X=sample_data)
dmd.dmd_time['t0'] = 8
dmd.dmd_time['tend'] = 11
expected_data = sample_data[:, 8:12]
np.testing.assert_allclose(dmd.reconstructed_data, expected_data)
def test_dmd_time_1(self):
dmd = DMD(svd_rank=2)
dmd.fit(X=sample_data)
expected_dict = {'dt': 1, 't0': 0, 'tend': 14}
np.testing.assert_equal(dmd.dmd_time, expected_dict)
def test_plot_modes_3(self):
dmd = DMD()
snapshots = [snap.reshape(20, 20) for snap in sample_data.T]
dmd.fit(X=snapshots)
dmd.plot_modes_2D()
plt.close()
def test_plot_snapshots_3(self):
dmd = DMD()
snapshots = [snap.reshape(20, 20) for snap in sample_data.T]
dmd.fit(X=snapshots)
dmd.plot_snapshots_2D()
plt.close()
def test_plot_eigs_2(self):
dmd = DMD()
dmd.fit(X=sample_data)
dmd.plot_eigs(show_axes=False, show_unit_circle=False)
plt.close()
def test_plot_snapshots_4(self):
dmd = DMD()
snapshots = [snap.reshape(20, 20) for snap in sample_data.T]
dmd.fit(X=snapshots)
dmd.plot_snapshots_2D(index_snap=2)
plt.close()
def test_tdmd_plot(self):
dmd = DMD(tlsq_rank=3)
dmd.fit(X=sample_data)
dmd.plot_eigs(show_axes=False, show_unit_circle=False)
plt.close()