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_reconstruct_b_unknown(self):
system = create_system_without_B()
dmdc = DMDc(svd_rank=-1, opt=True)
dmdc.fit(system['snapshots'], system['u'])
np.testing.assert_array_almost_equal(
dmdc.reconstructed_data(), system['snapshots'], decimal=6)
def test_B_b_known(self):
system = create_system_with_B()
dmdc = DMDc(svd_rank=-1)
dmdc.fit(system['snapshots'], system['u'], system['B'])
np.testing.assert_array_almost_equal(dmdc.B, system['B'])
def test_eigs_b_known(self):
system = create_system_with_B()
dmdc = DMDc(svd_rank=-1)
dmdc.fit(system['snapshots'], system['u'], system['B'])
real_eigs = np.array([0.1, 1.5])
np.testing.assert_array_almost_equal(dmdc.eigs, real_eigs)
def test_atilde_b_unknown(self):
system = create_system_without_B()
dmdc = DMDc(svd_rank=-1, opt=True)
dmdc.fit(system['snapshots'], system['u'])
expected_atilde = dmdc.basis.T.conj().dot(system['A']).dot(dmdc.basis)
np.testing.assert_array_almost_equal(
dmdc.atilde, expected_atilde, decimal=1)
def test_reconstruct_b_known(self):
system = create_system_with_B()
dmdc = DMDc(svd_rank=-1)
dmdc.fit(system['snapshots'], system['u'], system['B'])
np.testing.assert_array_almost_equal(dmdc.reconstructed_data(),
system['snapshots'])