Skip to content

Commit 129ac9a

Browse files
author
Takaya Uchida
committed
Add partial_amplitudes as an output of mrDMD
1 parent 9307c5a commit 129ac9a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pydmd/mrdmd.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,26 @@ def partial_eigs(self, level, node=None):
386386
[self.dmd_tree[level, leaf].eigs for leaf in leaves]
387387
)
388388

389+
def partial_amplitudes(self, level, node=None):
390+
"""
391+
Return the amplitudes of the specific `level` and of the specific
392+
`node`; if `node` is not specified, the method returns the amplitudes
393+
of the given `level` (all the nodes).
394+
395+
:param int level: the index of the level from where the amplitudes are
396+
extracted.
397+
:param int node: the index of the node from where the amplitudes are
398+
extracted; if None, the amplitudes are extracted from all the
399+
nodes of the given level. Default is None.
400+
401+
:return: the selected eigs
402+
:rtype: numpy.ndarray
403+
"""
404+
leaves = self.dmd_tree.index_leaves(level) if node is None else [node]
405+
return np.concatenate(
406+
[self.dmd_tree[level, leaf].amplitudes for leaf in leaves]
407+
)
408+
389409
def partial_reconstructed_data(self, level, node=None):
390410
"""
391411
Return the reconstructed data computed using the modes and the time

0 commit comments

Comments
 (0)