From 2858f063665ffb2b1d7b5a921ac25609f47c7835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 16 Aug 2024 00:35:53 +0200 Subject: [PATCH] pylint fixes --- src/gstools/covmodel/base.py | 10 ++++++---- src/gstools/covmodel/models.py | 2 +- src/gstools/covmodel/sum_tools.py | 9 +++++---- src/gstools/covmodel/tools.py | 1 - 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gstools/covmodel/base.py b/src/gstools/covmodel/base.py index 68af58d0..a495d80b 100644 --- a/src/gstools/covmodel/base.py +++ b/src/gstools/covmodel/base.py @@ -9,7 +9,7 @@ CovModel """ -# pylint: disable=C0103, R0201, E1101, C0302, W0613 +# pylint: disable=C0103, R0201, E1101, C0302, W0613, W0231 import copy import numpy as np @@ -1480,11 +1480,11 @@ def vars(self): return [mod.var for mod in self.models] @vars.setter - def vars(self, vars): - if len(vars) != len(self): + def vars(self, variances): + if len(variances) != len(self): msg = "SumModel: number of given variances not matching" raise ValueError(msg) - for mod, var in zip(self.models, vars): + for mod, var in zip(self.models, variances): mod.var = var check_arg_in_bounds(self, "var", error=True) check_arg_in_bounds(self, "len_scale", error=True) @@ -1555,6 +1555,7 @@ def angles(self, angles): @property def ratios(self): + """:class:`numpy.ndarray`: Variance ratios of the sub-models.""" var = self.var if np.isclose(var, 0) and len(self) > 0: return np.full(len(self), 1 / len(self)) @@ -1593,6 +1594,7 @@ def spectral_density(self, k): ) def correlation(self, r): + """SumModel correlation function.""" return sum( ( mod.correlation(r) * rat diff --git a/src/gstools/covmodel/models.py b/src/gstools/covmodel/models.py index 80dbd705..7c1cd836 100644 --- a/src/gstools/covmodel/models.py +++ b/src/gstools/covmodel/models.py @@ -22,7 +22,7 @@ JBessel """ -# pylint: disable=C0103, E1101, R0201 +# pylint: disable=C0103, C0302, E1101, R0201 import warnings import numpy as np diff --git a/src/gstools/covmodel/sum_tools.py b/src/gstools/covmodel/sum_tools.py index a4a1647a..c4b9a90e 100644 --- a/src/gstools/covmodel/sum_tools.py +++ b/src/gstools/covmodel/sum_tools.py @@ -17,6 +17,7 @@ sum_model_repr """ +# pylint: disable=W0212 import numpy as np from gstools.covmodel.tools import check_arg_in_bounds @@ -89,10 +90,10 @@ def sum_default_arg_bounds(summod): """Default boundaries for arguments as dict.""" var_bnds = [mod.var_bounds for mod in summod.models] len_bnds = [mod.len_scale_bounds for mod in summod.models] - var_lo = sum([bnd[0] for bnd in var_bnds], start=0.0) - var_hi = sum([bnd[1] for bnd in var_bnds], start=0.0) - len_lo = min([bnd[0] for bnd in len_bnds], default=0.0) - len_hi = max([bnd[1] for bnd in len_bnds], default=0.0) + var_lo = sum((bnd[0] for bnd in var_bnds), start=0.0) + var_hi = sum((bnd[1] for bnd in var_bnds), start=0.0) + len_lo = min((bnd[0] for bnd in len_bnds), default=0.0) + len_hi = max((bnd[1] for bnd in len_bnds), default=0.0) res = { "var": (var_lo, var_hi), "len_scale": (len_lo, len_hi), diff --git a/src/gstools/covmodel/tools.py b/src/gstools/covmodel/tools.py index 52a6e64c..69bf963b 100644 --- a/src/gstools/covmodel/tools.py +++ b/src/gstools/covmodel/tools.py @@ -34,7 +34,6 @@ from gstools.tools.misc import list_format __all__ = [ - "RatioError", "AttributeWarning", "rad_fac", "set_opt_args",