How to use the pydmd.hodmd.HODMD function in pydmd

To help you get started, we’ve selected a few pydmd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_dynamics_opt_1(self):
        dmd = HODMD(svd_rank=5, opt=True)
        dmd.fit(X=sample_data)
        assert dmd.dynamics.shape == (5, sample_data.shape[1])
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_eigs_1(self):
        dmd = HODMD(svd_rank=-1)
        dmd.fit(X=sample_data)
        assert len(dmd.eigs) == 14
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_dynamics_2(self):
        dmd = HODMD(svd_rank=1)
        dmd.fit(X=sample_data)
        expected_dynamics = np.array([[
            -2.20639502 - 9.10168802e-16j, 1.55679980 - 1.49626864e+00j,
            -0.08375915 + 2.11149018e+00j, -1.37280962 - 1.54663768e+00j,
            2.01748787 + 1.60312745e-01j, -1.53222592 + 1.25504678e+00j,
            0.23000498 - 1.92462280e+00j, 1.14289644 + 1.51396355e+00j,
            -1.83310653 - 2.93174173e-01j, 1.49222925 - 1.03626336e+00j,
            -0.35015209 + 1.74312867e+00j, -0.93504202 - 1.46738182e+00j,
            1.65485808 + 4.01263449e-01j, -1.43976061 + 8.39117825e-01j,
            0.44682540 - 1.56844403e+00j
        ]])
        np.testing.assert_allclose(dmd.dynamics, expected_dynamics)
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_dmd_time_4(self):
        dmd = HODMD(svd_rank=3)
        dmd.fit(X=sample_data)
        dmd.dmd_time['t0'] = 20
        dmd.dmd_time['tend'] = 20
        expected_data = np.array([[-7.29383297e+00 - 4.90248179e-14j],
                                  [-5.69109796e+00 - 2.74068833e+00j],
                                  [3.38410649e-83 + 3.75677740e-83j]])
        np.testing.assert_almost_equal(dmd.dynamics, expected_data, decimal=6)
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_dmd_time_3(self):
        dmd = HODMD()
        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)
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_plot_snapshots_3(self):
        dmd = HODMD()
        snapshots = [snap.reshape(20, 20) for snap in sample_data.T]
        dmd.fit(X=snapshots)
        dmd.plot_snapshots_2D()
        plt.close()
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_plot_snapshots_1(self):
        dmd = HODMD()
        dmd.fit(X=sample_data)
        with self.assertRaises(ValueError):
            dmd.plot_snapshots_2D()
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_plot_snapshots_2(self):
        dmd = HODMD(svd_rank=-1)
        dmd.fit(X=sample_data)
        dmd.plot_snapshots_2D((1, 2, 5), x=np.arange(20), y=np.arange(20))
        plt.close()
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_plot_modes_1(self):
        dmd = HODMD()
        dmd.fit(X=sample_data)
        with self.assertRaises(ValueError):
            dmd.plot_modes_2D()
github mathLab / PyDMD / tests / test_hodmd.py View on Github external
def test_original_timesteps(self):
        dmd = HODMD()
        dmd.fit(X=sample_data)
        np.testing.assert_allclose(dmd.original_timesteps,
                                   np.arange(sample_data.shape[1]))