Skip to content

Commit

Permalink
Merge pull request #147 from GeoStat-Framework/covmodel_arg_bounds_fix
Browse files Browse the repository at this point in the history
CovModels: limit exponent shape parameters to 50 to prevent numerical errors
  • Loading branch information
MuellerSeb authored Mar 23, 2021
2 parents 3f3a3ea + b7a58c4 commit 94aa49a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions gstools/covmodel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,14 @@ def default_opt_arg(self):
def default_opt_arg_bounds(self):
"""Defaults for boundaries of the optional arguments.
* ``{"alpha": [0.5, inf]}``
* ``{"alpha": [0.5, 50.0]}``
Returns
-------
:class:`dict`
Boundaries for optional arguments
"""
return {"alpha": [0.5, np.inf]}
return {"alpha": [0.5, 50.0]}

def cor(self, h):
"""Rational normalized correlation function."""
Expand Down Expand Up @@ -677,14 +677,14 @@ def default_opt_arg(self):
def default_opt_arg_bounds(self):
"""Defaults for boundaries of the optional arguments.
* ``{"nu": [(dim-1)/2, inf, "co"]}``
* ``{"nu": [(dim-1)/2, 50.0, "co"]}``
Returns
-------
:class:`dict`
Boundaries for optional arguments
"""
return {"nu": [(self.dim - 1) / 2, np.inf, "co"]}
return {"nu": [(self.dim - 1) / 2, 50.0, "co"]}

def cor(self, h):
"""Super-Spherical normalized correlation function."""
Expand Down Expand Up @@ -751,14 +751,14 @@ def default_opt_arg(self):
def default_opt_arg_bounds(self):
"""Defaults for boundaries of the optional arguments.
* ``{"nu": [dim/2 - 1, inf, "co"]}``
* ``{"nu": [dim/2 - 1, 50.0, "co"]}``
Returns
-------
:class:`dict`
Boundaries for optional arguments
"""
return {"nu": [self.dim / 2 - 1, np.inf, "co"]}
return {"nu": [self.dim / 2 - 1, 50.0, "co"]}

def check_opt_arg(self):
"""Check the optional arguments.
Expand Down
18 changes: 9 additions & 9 deletions gstools/covmodel/tpl_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class TPLGaussian(TPLCovModel):
Default: ``0.5``
len_low : :class:`float`, optional
The lower length scale truncation of the model.
Standard range: ``[0, 1000]``.
Standard range: ``[0, inf]``.
Default: ``0.0``
"""

Expand All @@ -167,7 +167,7 @@ def default_opt_arg(self):
def default_opt_arg_bounds(self):
"""Defaults for boundaries of the optional arguments.
* ``{"hurst": [0, 1, "oo"], "len_low": [0, 1000, "cc"]}``
* ``{"hurst": [0, 1, "oo"], "len_low": [0, inf, "cc"]}``
Returns
-------
Expand Down Expand Up @@ -275,7 +275,7 @@ class TPLExponential(TPLCovModel):
Default: ``0.5``
len_low : :class:`float`, optional
The lower length scale truncation of the model.
Standard range: ``[0, 1000]``.
Standard range: ``[0, inf]``.
Default: ``0.0``
"""

Expand All @@ -294,7 +294,7 @@ def default_opt_arg(self):
def default_opt_arg_bounds(self):
"""Defaults for boundaries of the optional arguments.
* ``{"hurst": [0, 1, "oo"], "len_low": [0, 1000, "cc"]}``
* ``{"hurst": [0, 1, "oo"], "len_low": [0, inf, "cc"]}``
Returns
-------
Expand Down Expand Up @@ -413,7 +413,7 @@ class TPLStable(TPLCovModel):
Default: ``1.5``
len_low : :class:`float`, optional
The lower length scale truncation of the model.
Standard range: ``[0, 1000]``.
Standard range: ``[0, inf]``.
Default: ``0.0``
"""

Expand All @@ -434,7 +434,7 @@ def default_opt_arg_bounds(self):
* ``{"hurst": [0, 1, "oo"],
"alpha": [0, 2, "oc"],
"len_low": [0, 1000, "cc"]}``
"len_low": [0, inf, "cc"]}``
Returns
-------
Expand All @@ -459,7 +459,7 @@ def check_opt_arg(self):
if self.alpha < 0.3:
warnings.warn(
"TPLStable: parameter 'alpha' is < 0.3, "
+ "count with unstable results",
"count with unstable results",
AttributeWarning,
)

Expand Down Expand Up @@ -537,14 +537,14 @@ def default_opt_arg(self):
def default_opt_arg_bounds(self):
"""Defaults for boundaries of the optional arguments.
* ``{"nu": [dim/2 - 1, inf, "co"]}``
* ``{"nu": [dim/2 - 1, 50.0, "co"]}``
Returns
-------
:class:`dict`
Boundaries for optional arguments
"""
return {"nu": [(self.dim + 1) / 2, np.inf, "co"]}
return {"nu": [(self.dim + 1) / 2, 50.0, "co"]}

def cor(self, h):
"""TPL Simple - normalized correlation function."""
Expand Down

0 comments on commit 94aa49a

Please sign in to comment.