diff options
-rw-r--r-- | var/spack/repos/builtin/packages/py-pydmd/isuue-133.patch | 31 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/py-pydmd/package.py | 49 |
2 files changed, 80 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-pydmd/isuue-133.patch b/var/spack/repos/builtin/packages/py-pydmd/isuue-133.patch new file mode 100644 index 0000000000..a7a55260ef --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pydmd/isuue-133.patch @@ -0,0 +1,31 @@ +diff --git a/pydmd/dmdbase.py b/pydmd/dmdbase.py +index 17f3662..778a6b8 100644 +--- a/pydmd/dmdbase.py ++++ b/pydmd/dmdbase.py +@@ -201,7 +201,7 @@ class DMDBase(object): + else: + input_shapes = [np.asarray(x).shape for x in X] + +- if len(set(input_shapes)) is not 1: ++ if len(set(input_shapes)) != 1: + raise ValueError('Snapshots have not the same dimension.') + + snapshots_shape = input_shapes[0] +@@ -235,7 +235,7 @@ class DMDBase(object): + https://arxiv.org/pdf/1502.03854.pdf + """ + # Do not perform tlsq +- if tlsq_rank is 0: ++ if tlsq_rank == 0: + return X, Y + + V = np.linalg.svd(np.append(X, Y, axis=0), full_matrices=False)[-1] +@@ -269,7 +269,7 @@ class DMDBase(object): + U, s, V = np.linalg.svd(X, full_matrices=False) + V = V.conj().T + +- if svd_rank is 0: ++ if svd_rank == 0: + omega = lambda x: 0.56 * x ** 3 - 0.95 * x ** 2 + 1.82 * x + 1.43 + beta = np.divide(*sorted(X.shape)) + tau = np.median(s) * omega(beta) diff --git a/var/spack/repos/builtin/packages/py-pydmd/package.py b/var/spack/repos/builtin/packages/py-pydmd/package.py new file mode 100644 index 0000000000..a2bd7ec646 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pydmd/package.py @@ -0,0 +1,49 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PyPydmd(PythonPackage): + """PyDMD is a Python package that uses Dynamic Mode Decomposition + for a data-driven model simplification based on spatiotemporal + coherent structures.""" + + homepage = "https://mathlab.github.io/PyDMD/" + url = "https://github.com/mathLab/PyDMD/archive/v0.3.tar.gz" + + version('0.3', sha256='f490fc139677e4d9fc1240636a2c5992d22879517c9574d13164dc5179b0f785') + + variant('docs', default=False, description='Build HTML documentation') + + depends_on('python@3:', type=('build', 'run')) + depends_on('py-setuptools', type='build') + depends_on('py-numpy', type=('build', 'run')) + depends_on('py-scipy', type=('build', 'run')) + depends_on('py-matplotlib', type=('build', 'run')) + depends_on('py-future', type=('build', 'run')) + depends_on('py-nose', type='test') + depends_on('texlive', type='build', when='+docs') + depends_on('py-sphinx@1.4.0:1.4.99', type='build', when='+docs') + depends_on('py-sphinx-rtd-theme', type='build', when='+docs') + + # https://github.com/mathLab/PyDMD/pull/133 + patch('isuue-133.patch', when='@0.3') + + @run_after('build') + def build_docs(self): + if '+docs' in self.spec: + with working_dir('docs'): + make('html') + + @run_after('install') + def install_docs(self): + if '+docs' in self.spec: + install_tree('docs', self.prefix.docs) + + @run_after('build') + @on_package_attributes(run_tests=True) + def build_test(self): + python('test.py') |