From 7303f2038cd714150b6cfc6a90ac87bd8c172a94 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Thu, 13 Jan 2022 13:53:13 +0100 Subject: [PATCH] add method name to key --- flake.nix | 1 + poetry.lock | 123 ++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 3 +- stocproc/stocproc.py | 9 ++-- 4 files changed, 130 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index ef3793d..528ed86 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,7 @@ outputs = { self, utils, nixpkgs, ... }: (utils.lib.poetry2nixWrapper nixpkgs { name = "stocproc"; + shellPackages = pkgs: with pkgs; [ pyright ]; poetryArgs = { projectDir = ./.; }; diff --git a/poetry.lock b/poetry.lock index cf9e331..b6980ea 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,3 +1,48 @@ +[[package]] +name = "black" +version = "21.12b0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.6.2" + +[package.dependencies] +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.9.0,<1" +platformdirs = ">=2" +tomli = ">=0.2.6,<2.0.0" +typing-extensions = [ + {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}, + {version = "!=3.10.0.1", markers = "python_version >= \"3.10\""}, +] + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +python2 = ["typed-ast (>=1.4.3)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "click" +version = "8.0.3" +description = "Composable command line interface toolkit" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + [[package]] name = "cython" version = "0.29.26" @@ -37,6 +82,14 @@ python-versions = "*" develop = ["pytest (>=4.6)", "pycodestyle", "pytest-cov", "codecov", "wheel"] tests = ["pytest (>=4.6)"] +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "numpy" version = "1.21.5" @@ -45,6 +98,26 @@ category = "main" optional = false python-versions = ">=3.7,<3.11" +[[package]] +name = "pathspec" +version = "0.9.0" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[[package]] +name = "platformdirs" +version = "2.4.1" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["Sphinx (>=4)", "furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)"] +test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"] + [[package]] name = "scipy" version = "1.7.3" @@ -56,12 +129,40 @@ python-versions = ">=3.7,<3.11" [package.dependencies] numpy = ">=1.16.5,<1.23.0" +[[package]] +name = "tomli" +version = "1.2.3" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "typing-extensions" +version = "4.0.1" +description = "Backported and Experimental Type Hints for Python 3.6+" +category = "dev" +optional = false +python-versions = ">=3.6" + [metadata] lock-version = "1.1" python-versions = ">=3.9,<3.11" -content-hash = "a43d0d8216b1df43926184346180f4b6d20fd52a77d9808a7a1120474fc9949e" +content-hash = "979721bee90031dd60188ca34a606455f0f65e0a7ab655415772c946250ce316" [metadata.files] +black = [ + {file = "black-21.12b0-py3-none-any.whl", hash = "sha256:a615e69ae185e08fdd73e4715e260e2479c861b5740057fde6e8b4e3b7dd589f"}, + {file = "black-21.12b0.tar.gz", hash = "sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3"}, +] +click = [ + {file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"}, + {file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] cython = [ {file = "Cython-0.29.26-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c4b003b6b7aa9e74552ef8d4e6009b3e3c3e8fa585710b3a6d062e088e460c1b"}, {file = "Cython-0.29.26-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:ce804a021c92fea66c8c100781a111706f21bade7a546895c5a9c57fe2df8b24"}, @@ -115,6 +216,10 @@ mpmath = [ {file = "mpmath-1.2.1-py3-none-any.whl", hash = "sha256:604bc21bd22d2322a177c73bdb573994ef76e62edd595d17e00aff24b0667e5c"}, {file = "mpmath-1.2.1.tar.gz", hash = "sha256:79ffb45cf9f4b101a807595bcb3e72e0396202e0b1d25d689134b48c4216a81a"}, ] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] numpy = [ {file = "numpy-1.21.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:301e408a052fdcda5cdcf03021ebafc3c6ea093021bf9d1aa47c54d48bdad166"}, {file = "numpy-1.21.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a7e8f6216f180f3fd4efb73de5d1eaefb5f5a1ee5b645c67333033e39440e63a"}, @@ -147,6 +252,14 @@ numpy = [ {file = "numpy-1.21.5-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a7c4b701ca418cd39e28ec3b496e6388fe06de83f5f0cb74794fa31cfa384c02"}, {file = "numpy-1.21.5.zip", hash = "sha256:6a5928bc6241264dce5ed509e66f33676fc97f464e7a919edc672fb5532221ee"}, ] +pathspec = [ + {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, + {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, +] +platformdirs = [ + {file = "platformdirs-2.4.1-py3-none-any.whl", hash = "sha256:1d7385c7db91728b83efd0ca99a5afb296cab9d0ed8313a45ed8ba17967ecfca"}, + {file = "platformdirs-2.4.1.tar.gz", hash = "sha256:440633ddfebcc36264232365d7840a970e75e1018d15b4327d11f91909045fda"}, +] scipy = [ {file = "scipy-1.7.3-1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:c9e04d7e9b03a8a6ac2045f7c5ef741be86727d8f49c45db45f244bdd2bcff17"}, {file = "scipy-1.7.3-1-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:b0e0aeb061a1d7dcd2ed59ea57ee56c9b23dd60100825f98238c06ee5cc4467e"}, @@ -178,3 +291,11 @@ scipy = [ {file = "scipy-1.7.3-cp39-cp39-win_amd64.whl", hash = "sha256:3f78181a153fa21c018d346f595edd648344751d7f03ab94b398be2ad083ed3e"}, {file = "scipy-1.7.3.tar.gz", hash = "sha256:ab5875facfdef77e0a47d5fd39ea178b58e60e454a4c85aa1e52fcb80db7babf"}, ] +tomli = [ + {file = "tomli-1.2.3-py3-none-any.whl", hash = "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"}, + {file = "tomli-1.2.3.tar.gz", hash = "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f"}, +] +typing-extensions = [ + {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, + {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, +] diff --git a/pyproject.toml b/pyproject.toml index 9a6fe86..5d4b0e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] description = "Generate continuous time stationary stochastic processes from a given auto correlation function." name = "stocproc" -version = "1.0.1" +version = "1.0.2" authors = ["Richard Hartmann "] license = "BSD (3 clause)" classifiers = [ @@ -23,6 +23,7 @@ fcSpline = { git = "https://github.com/vale981/fcSpline" } [tool.poetry.dev-dependencies] setuptools = "^59.5.0" Cython = "^0.29.25" +black = "^21.12b0" [build-system] requires = ["poetry>=0.12", "cython", "setuptools", "numpy"] diff --git a/stocproc/stocproc.py b/stocproc/stocproc.py index 697fe47..9b6c24f 100644 --- a/stocproc/stocproc.py +++ b/stocproc/stocproc.py @@ -359,7 +359,7 @@ class StocProc_KLE(StocProc): @staticmethod def get_key(r_tau, t_max, tol=1e-2): - return r_tau, t_max, tol + return "kle", r_tau, t_max, tol # def get_key(self): # """Returns the tuple (r_tau, t_max, tol) which should suffice to identify the process in order to load/dump @@ -382,6 +382,7 @@ class StocProc_KLE(StocProc): def __setstate__(self, state): sqrt_lambda_ui_fine, t_max, num_grid_points, seed, scale, self.key = state + self.key = ("kle", *self.key) num_ev, ng = sqrt_lambda_ui_fine.shape super().__init__( t_max=t_max, num_grid_points=num_grid_points, seed=seed, scale=scale @@ -556,7 +557,7 @@ class StocProc_FFT(StocProc): Returns the tuple ``(alpha, t_max, intgr_tol, intpl_tol)`` which uniquely identifies a particular :py:class:`StocProc_FFT` instance """ - return alpha, t_max, intgr_tol, intpl_tol + return "fft", alpha, t_max, intgr_tol, intpl_tol def __getstate__(self): return ( @@ -638,7 +639,7 @@ class StocProc_TanhSinh(StocProc): scale=1, calc_deriv=False, ): - self.key = alpha, t_max, intgr_tol, intpl_tol + self.key = "ts", alpha, t_max, intgr_tol, intpl_tol if not negative_frequencies: log.info("non neg freq only") log.info("get_dt_for_accurate_interpolation, please wait ...") @@ -737,7 +738,7 @@ class StocProc_TanhSinh(StocProc): @staticmethod def get_key(t_max, alpha, intgr_tol=1e-2, intpl_tol=1e-2): - return alpha, t_max, intgr_tol, intpl_tol + return "ts", alpha, t_max, intgr_tol, intpl_tol def __getstate__(self): return (