From 6db93231fc5f12378820e3b49db780a43170594d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 2 Jul 2021 17:03:49 +0200 Subject: [PATCH 1/5] RNG.sample_ln_pdf: force sample_size to be integer --- gstools/random/rng.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gstools/random/rng.py b/gstools/random/rng.py index 5b740f7c..d8fe298d 100644 --- a/gstools/random/rng.py +++ b/gstools/random/rng.py @@ -78,6 +78,8 @@ def sample_ln_pdf( sample_size = burn_in else: sample_size = max(burn_in, (size / nwalkers) * oversampling_factor) + # sample_size needs to be integer for emcee >= 3.1 + sample_size = int(sample_size) # initial guess init_guess = ( self.random.rand(nwalkers).reshape((nwalkers, 1)) * sample_around From 9b371366466350ef8909822c484ffddce73f36a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 2 Jul 2021 17:04:10 +0200 Subject: [PATCH 2/5] CI: show diff for black check --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b9d4bb73..e4cdfabb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: - name: black check run: | - python -m black --check . + python -m black --check --diff --color . - name: pylint check run: | From 1818e7c4245a8c76492dbf48642b1907d11549b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 2 Jul 2021 17:12:07 +0200 Subject: [PATCH 3/5] Update Changelog for #184 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d440cf1f..5dde1d49 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to **GSTools** will be documented in this file. ### Bugfixes - `vario_estimate` was altering the input field unter certain circumstances [#180](https://github.com/GeoStat-Framework/GSTools/issues/180) +- `emcee` v3.1 now requires `nsteps` in `run_mcmc()` to be integer (called in `RNG.sample_ln_pdf`) [#184](https://github.com/GeoStat-Framework/GSTools/pull/184) ## [1.3.1] - Pure Pink - 2021-06 From eb91ff875013d2fdb0012c2ea044d4dc9ad201cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 2 Jul 2021 17:46:47 +0200 Subject: [PATCH 4/5] PyLint: fix C0206 for iterating over dicts --- gstools/covmodel/base.py | 3 +-- gstools/covmodel/tools.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/gstools/covmodel/base.py b/gstools/covmodel/base.py index b36a45c8..f8c86589 100644 --- a/gstools/covmodel/base.py +++ b/gstools/covmodel/base.py @@ -212,11 +212,10 @@ def __init_subclass__(cls): cls.__doc__ += CovModel.__doc__[45:] # overridden functions get standard doc if no new doc was created ign = ["__", "variogram", "covariance", "cor"] - for att in cls.__dict__: + for att, attr_cls in cls.__dict__.items(): if any(att.startswith(i) for i in ign) or att not in dir(CovModel): continue attr_doc = getattr(CovModel, att).__doc__ - attr_cls = cls.__dict__[att] if attr_cls.__doc__ is None: attr_cls.__doc__ = attr_doc diff --git a/gstools/covmodel/tools.py b/gstools/covmodel/tools.py index 01dc5db9..b3abf1ab 100644 --- a/gstools/covmodel/tools.py +++ b/gstools/covmodel/tools.py @@ -412,30 +412,30 @@ def set_arg_bounds(model, check_args=True, **kwargs): """ # if variance needs to be resetted, do this at last var_bnds = [] - for arg in kwargs: - if not check_bounds(kwargs[arg]): + for arg, bounds in kwargs.items(): + if not check_bounds(bounds): raise ValueError( "Given bounds for '{0}' are not valid, got: {1}".format( - arg, kwargs[arg] + arg, bounds ) ) if arg in model.opt_arg: - model._opt_arg_bounds[arg] = kwargs[arg] + model._opt_arg_bounds[arg] = bounds elif arg == "var": - var_bnds = kwargs[arg] + var_bnds = bounds continue elif arg == "len_scale": - model.len_scale_bounds = kwargs[arg] + model.len_scale_bounds = bounds elif arg == "nugget": - model.nugget_bounds = kwargs[arg] + model.nugget_bounds = bounds elif arg == "anis": - model.anis_bounds = kwargs[arg] + model.anis_bounds = bounds else: raise ValueError( "set_arg_bounds: unknown argument '{}'".format(arg) ) if check_args and check_arg_in_bounds(model, arg) > 0: - def_arg = default_arg_from_bounds(kwargs[arg]) + def_arg = default_arg_from_bounds(bounds) if arg == "anis": setattr(model, arg, [def_arg] * (model.dim - 1)) else: From c1a210d6769a0e2247dc3b21cbfe916a37e4768d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 2 Jul 2021 17:47:16 +0200 Subject: [PATCH 5/5] CI: fix major versions of all dependencies --- .github/workflows/main.yml | 2 +- setup.cfg | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4cdfabb..f19abcb4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install black pylint + pip install black 'pylint<3' pip install --editable . - name: black check diff --git a/setup.cfg b/setup.cfg index 53e4bbf0..55086556 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,7 +40,7 @@ packages = find: install_requires = emcee>=3.0.0,<4 hankel>=1.0.2,<2 - meshio>=4.0.3,<5.0 + meshio>=4.0.3,<5 numpy>=1.14.5,<2 pyevtk>=1.1.1,<2 scipy>=1.1.0,<2 @@ -54,19 +54,19 @@ exclude = [options.extras_require] doc = - m2r2 - matplotlib>=3 - meshzoo - numpydoc>=1.1 - pykrige>=1.5 - pyvista - sphinx>=3 - sphinx-gallery>=0.8 - sphinx-rtd-theme>=0.5 + m2r2>=0.2.8,<1 + matplotlib>=3,<4 + meshzoo>=0.7,<1 + numpydoc>=1.1,<2 + pykrige>=1.5,<2 + pyvista>=0.31,<1 + sphinx>=3,<4 + sphinx-gallery>=0.8,<1 + sphinx-rtd-theme>=0.5,<1 plotting = - matplotlib - pyvista + matplotlib>=3,<4 + pyvista>=0.29,<1 test = - coverage[toml]>=5.2.1 - pytest>=6.0 - pytest-cov>=2.11.0 + coverage[toml]>=5.2.1,<6 + pytest>=6.0,<7 + pytest-cov>=2.11.0,<3