예제 #1
0
 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)
예제 #2
0
 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()
예제 #3
0
 def test_reconstructed_data(self):
     dmd = DMD()
     dmd.fit(X=sample_data)
     dmd_data = dmd.reconstructed_data
     np.testing.assert_allclose(dmd_data, sample_data)
예제 #4
0
 def test_original_timesteps(self):
     dmd = DMD()
     dmd.fit(X=sample_data)
     np.testing.assert_allclose(dmd.original_timesteps,
                                np.arange(sample_data.shape[1]))
예제 #5
0
 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()
예제 #6
0
 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])
예제 #7
0
 def test_rank(self):
     dmd = DMD(svd_rank=0.9)
     dmd.fit(X=sample_data)
     assert len(dmd.eigs) == 2
예제 #8
0
 def test_plot_modes_4(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)
     plt.close()
예제 #9
0
 def test_sorted_eigs_default(self):
     dmd = DMD()
     assert dmd.operator._sorted_eigs == False
예제 #10
0
 def test_sorted_eigs_set_real(self):
     dmd = DMD(sorted_eigs='real')
     assert dmd.operator._sorted_eigs == 'real'
예제 #11
0
 def test_truncation_shape(self):
     dmd = DMD(svd_rank=3)
     dmd.fit(X=sample_data)
     assert dmd.modes.shape[1] == 3
예제 #12
0
 def test_shape(self):
     dmd = DMD(svd_rank=-1)
     dmd.fit(X=sample_data)
     assert dmd.modes.shape[1] == sample_data.shape[1] - 1
예제 #13
0
 def test_rescale_mode_coefficients_count_check(self):
     dmd_rescale = DMD(svd_rank=5,
                       opt=True,
                       rescale_mode=np.linspace(5, 10, 6))
     with self.assertRaises(ValueError):
         dmd_rescale.fit(X=sample_data)
예제 #14
0
 def test_plot_modes_1(self):
     dmd = DMD()
     dmd.fit(X=sample_data)
     with self.assertRaises(ValueError):
         dmd.plot_modes_2D()
예제 #15
0
 def test_Atilde_shape(self):
     dmd = DMD(svd_rank=3)
     dmd.fit(X=sample_data)
     assert dmd.atilde.shape == (dmd.svd_rank, dmd.svd_rank)
예제 #16
0
 def test_plot_modes_2(self):
     dmd = DMD(svd_rank=-1)
     dmd.fit(X=sample_data)
     dmd.plot_modes_2D((1, 2, 5), x=np.arange(20), y=np.arange(20))
     plt.close()
예제 #17
0
 def test_eigs_2(self):
     dmd = DMD(svd_rank=5)
     dmd.fit(X=sample_data)
     assert len(dmd.eigs) == 5
예제 #18
0
 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')
예제 #19
0
 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()