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_opt(self):
dmd = DMDBase(opt=True)
assert dmd.opt == True
def test_exact_default(self):
dmd = DMDBase()
assert dmd.exact == False
def test_opt_default(self):
dmd = DMDBase()
assert dmd.opt == False
def test_tlsq_rank(self):
dmd = DMDBase(tlsq_rank=2)
assert dmd.tlsq_rank == 2
def test_plot_snaps_2D(self):
dmd = DMDBase()
with self.assertRaises(ValueError):
dmd.plot_snapshots_2D()
def test_tlsq_rank_default(self):
dmd = DMDBase()
assert dmd.tlsq_rank == 0
def test_svd_rank_default(self):
dmd = DMDBase()
assert dmd.svd_rank == 0
"""
Derived module from dmdbase.py for forward/backward dmd.
"""
import numpy as np
from scipy.linalg import sqrtm
from .dmdbase import DMDBase
class FbDMD(DMDBase):
"""
Forward/backward DMD class.
:param svd_rank: the rank for the truncation; If 0, the method computes the
optimal rank and uses it for truncation; if positive interger, the
method uses the argument for the truncation; if float between 0 and 1,
the rank is the number of the biggest singular values that are needed
to reach the 'energy' specified by `svd_rank`; if -1, the method does
not compute truncation.
:type svd_rank: int or float
:param int tlsq_rank: rank truncation computing Total Least Square. Default
is 0, that means TLSQ is not applied.
:param bool exact: flag to compute either exact DMD or projected DMD.
Default is False.
:param bool opt: flag to compute optimal amplitudes. See :class:`DMDBase`.
Default is False.
Reference:
- Kutz, J. Nathan, Xing Fu, and Steven L. Brunton. Multiresolution Dynamic Mode
Decomposition. SIAM Journal on Applied Dynamical Systems 15.2 (2016): 713-735.
"""
from __future__ import division
from builtins import range
from past.utils import old_div
import numpy as np
import scipy.linalg
import matplotlib.pyplot as plt
from .dmdbase import DMDBase
class MrDMD(DMDBase):
"""
Multi-resolution Dynamic Mode Decomposition
:param svd_rank: the rank for the truncation; If 0, the method computes the
optimal rank and uses it for truncation; if positive interger, the
method uses the argument for the truncation; if float between 0 and 1,
the rank is the number of the biggest singular values that are needed
to reach the 'energy' specified by `svd_rank`; if -1, the method does
not compute truncation.
:type svd_rank: int or float
:param int tlsq_rank: rank truncation computing Total Least Square. Default
is 0, that means TLSQ is not applied.
:param bool exact: flag to compute either exact DMD or projected DMD.
Default is False.
:param bool opt: flag to compute optimal amplitudes. See :class:`DMDBase`.
Default is False.
"""
Derived module from dmdbase.py for dmd with control.
Reference:
- Proctor, J.L., Brunton, S.L. and Kutz, J.N., 2016. Dynamic mode decomposition
with control. SIAM Journal on Applied Dynamical Systems, 15(1), pp.142-161.
"""
from .dmdbase import DMDBase
from past.utils import old_div
import numpy as np
class DMDc(DMDBase):
"""
Dynamic Mode Decomposition with control.
This version does not allow to manipulate the temporal window within the
system is reconstructed.
:param svd_rank: the rank for the truncation; If 0, the method computes the
optimal rank and uses it for truncation; if positive interger, the
method uses the argument for the truncation; if float between 0 and 1,
the rank is the number of the biggest singular values that are needed
to reach the 'energy' specified by `svd_rank`; if -1, the method does
not compute truncation.
:type svd_rank: int or float
:param int tlsq_rank: rank truncation computing Total Least Square. Default
is 0, that means no truncation.
:param bool opt: flag to compute optimal amplitudes. See :class:`DMDBase`.
Default is False.