Skip to content

Commit

Permalink
pylint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MuellerSeb committed Aug 15, 2024
1 parent dbdfa27 commit 2858f06
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
10 changes: 6 additions & 4 deletions src/gstools/covmodel/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -1593,6 +1594,7 @@ def spectral_density(self, k):
)

def correlation(self, r):
"""SumModel correlation function."""
return sum(
(
mod.correlation(r) * rat
Expand Down
2 changes: 1 addition & 1 deletion src/gstools/covmodel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
JBessel
"""

# pylint: disable=C0103, E1101, R0201
# pylint: disable=C0103, C0302, E1101, R0201
import warnings

import numpy as np
Expand Down
9 changes: 5 additions & 4 deletions src/gstools/covmodel/sum_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
sum_model_repr
"""

# pylint: disable=W0212
import numpy as np

from gstools.covmodel.tools import check_arg_in_bounds
Expand Down Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion src/gstools/covmodel/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from gstools.tools.misc import list_format

__all__ = [
"RatioError",
"AttributeWarning",
"rad_fac",
"set_opt_args",
Expand Down

0 comments on commit 2858f06

Please sign in to comment.