Skip to content

Commit

Permalink
update docstrings according to pydocstyle; set all dtypes to np.double
Browse files Browse the repository at this point in the history
  • Loading branch information
MuellerSeb committed May 24, 2019
1 parent 9890ea8 commit 4f2c45c
Show file tree
Hide file tree
Showing 15 changed files with 243 additions and 224 deletions.
151 changes: 80 additions & 71 deletions gstools/covmodel/base.py

Large diffs are not rendered by default.

108 changes: 57 additions & 51 deletions gstools/covmodel/models.py

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions gstools/covmodel/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


def plot_variogram(model, x_min=0.0, x_max=None):
"""plot variogram of a given CovModel"""
"""Plot variogram of a given CovModel."""
if x_max is None:
x_max = 3 * model.integral_scale
x_s = np.linspace(x_min, x_max)
Expand All @@ -44,7 +44,7 @@ def plot_variogram(model, x_min=0.0, x_max=None):


def plot_covariance(model, x_min=0.0, x_max=None):
"""plot covariance of a given CovModel"""
"""Plot covariance of a given CovModel."""
if x_max is None:
x_max = 3 * model.integral_scale
x_s = np.linspace(x_min, x_max)
Expand All @@ -54,7 +54,7 @@ def plot_covariance(model, x_min=0.0, x_max=None):


def plot_correlation(model, x_min=0.0, x_max=None):
"""plot correlation function of a given CovModel"""
"""Plot correlation function of a given CovModel."""
if x_max is None:
x_max = 3 * model.integral_scale
x_s = np.linspace(x_min, x_max)
Expand All @@ -64,7 +64,7 @@ def plot_correlation(model, x_min=0.0, x_max=None):


def plot_variogram_normed(model, x_min=0.0, x_max=None):
"""plot normalized variogram of a given CovModel"""
"""Plot normalized variogram of a given CovModel."""
if x_max is None:
x_max = 3 * model.integral_scale
x_s = np.linspace(x_min, x_max)
Expand All @@ -76,7 +76,7 @@ def plot_variogram_normed(model, x_min=0.0, x_max=None):


def plot_spectrum(model, x_min=0.0, x_max=None):
"""plot specturm of a given CovModel"""
"""Plot specturm of a given CovModel."""
if x_max is None:
x_max = 3 / model.integral_scale
x_s = np.linspace(x_min, x_max)
Expand All @@ -90,7 +90,7 @@ def plot_spectrum(model, x_min=0.0, x_max=None):


def plot_spectral_density(model, x_min=0.0, x_max=None):
"""plot spectral density of a given CovModel"""
"""Plot spectral density of a given CovModel."""
if x_max is None:
x_max = 3 / model.integral_scale
x_s = np.linspace(x_min, x_max)
Expand All @@ -104,7 +104,7 @@ def plot_spectral_density(model, x_min=0.0, x_max=None):


def plot_spectral_rad_pdf(model, x_min=0.0, x_max=None):
"""plot radial spectral propability density function of a given CovModel"""
"""Plot radial spectral pdf of a given CovModel."""
if x_max is None:
x_max = 3 / model.integral_scale
x_s = np.linspace(x_min, x_max)
Expand Down
11 changes: 6 additions & 5 deletions gstools/covmodel/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
else:

class InitSubclassMeta(type):
"""Metaclass that implements PEP 487 protocol
"""Metaclass that implements PEP 487 protocol.
Notes
-----
Expand All @@ -43,6 +43,7 @@ class InitSubclassMeta(type):
"""

def __new__(cls, name, bases, ns, **kwargs):
"""Create a new subclass."""
__init_subclass__ = ns.pop("__init_subclass__", None)
if __init_subclass__:
__init_subclass__ = classmethod(__init_subclass__)
Expand All @@ -62,7 +63,7 @@ def __init__(cls, name, bases, ns, **kwargs):


def rad_fac(dim, r):
"""The volume element of the n-dimensional spherical coordinates.
"""Volume element of the n-dimensional spherical coordinates.
Given as a factor for integration of a radial-symmetric function.
Expand Down Expand Up @@ -90,7 +91,7 @@ def rad_fac(dim, r):


def set_len_anis(dim, len_scale, anis):
"""Setting the length scale and anisotropy factors for the given dimension.
"""Set the length scale and anisotropy factors for the given dimension.
Parameters
----------
Expand Down Expand Up @@ -139,7 +140,7 @@ def set_len_anis(dim, len_scale, anis):
constant_values=out_len_scale,
)
# if multiple length-scales are given, calculate the anisotropies
out_anis = np.zeros(dim - 1, dtype=float)
out_anis = np.zeros(dim - 1, dtype=np.double)
for i in range(1, dim):
out_anis[i - 1] = ls_tmp[i] / ls_tmp[0]

Expand All @@ -152,7 +153,7 @@ def set_len_anis(dim, len_scale, anis):


def set_angles(dim, angles):
"""Setting the angles for the given dimension.
"""Set the angles for the given dimension.
Parameters
----------
Expand Down
38 changes: 19 additions & 19 deletions gstools/covmodel/tpl_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


class TPLGaussian(CovModel):
r"""Truncated-Power-Law with Gaussian modes
r"""Truncated-Power-Law with Gaussian modes.
Notes
-----
Expand Down Expand Up @@ -108,14 +108,14 @@ class TPLGaussian(CovModel):

@property
def len_up(self):
""":class:`float`: The upper length scale truncation of the model.
""":class:`float`: Upper length scale truncation of the model.
* ``len_up = len_low + len_scale``
"""
return self.len_low + self.len_scale

def var_factor(self):
r"""Factor for C (Power-Law factor) to result in variance
r"""Factor for C (Power-Law factor) to result in variance.
This is used to result in the right variance, which is depending
on the hurst coefficient and the length-scale extents
Expand All @@ -133,7 +133,7 @@ def var_factor(self):
) / (2 * self.hurst)

def default_opt_arg(self):
"""The defaults for the optional arguments:
"""Defaults for the optional arguments.
* ``{"hurst": 0.5, "len_low": 0.0}``
Expand All @@ -145,7 +145,7 @@ def default_opt_arg(self):
return {"hurst": 0.5, "len_low": 0.0}

def default_opt_arg_bounds(self):
"""The defaults boundaries for the optional arguments:
"""Defaults for boundaries of the optional arguments.
* ``{"hurst": [0, 1, "oo"], "len_low": [0, 1000, "cc"]}``
Expand All @@ -157,7 +157,7 @@ def default_opt_arg_bounds(self):
return {"hurst": [0, 1, "oo"], "len_low": [0, 1000, "cc"]}

def correlation(self, r):
r"""Truncated-Power-Law with Gaussian modes - correlation function
r"""Truncated-Power-Law with Gaussian modes - correlation function.
If ``len_low=0`` we have a simple representation:
Expand Down Expand Up @@ -196,7 +196,7 @@ def correlation(self, r):


class TPLExponential(CovModel):
r"""Truncated-Power-Law with Exponential modes
r"""Truncated-Power-Law with Exponential modes.
Notes
-----
Expand Down Expand Up @@ -276,14 +276,14 @@ class TPLExponential(CovModel):

@property
def len_up(self):
""":class:`float`: The upper length scale truncation of the model.
""":class:`float`: Upper length scale truncation of the model.
* ``len_up = len_low + len_scale``
"""
return self.len_low + self.len_scale

def var_factor(self):
r"""Factor for C (Power-Law factor) to result in variance
r"""Factor for C (Power-Law factor) to result in variance.
This is used to result in the right variance, which is depending
on the hurst coefficient and the length-scale extents
Expand All @@ -301,7 +301,7 @@ def var_factor(self):
) / (2 * self.hurst)

def default_opt_arg(self):
"""The defaults for the optional arguments:
"""Defaults for the optional arguments.
* ``{"hurst": 0.5, "len_low": 0.0}``
Expand All @@ -313,7 +313,7 @@ def default_opt_arg(self):
return {"hurst": 0.5, "len_low": 0.0}

def default_opt_arg_bounds(self):
"""The defaults boundaries for the optional arguments:
"""Defaults for boundaries of the optional arguments.
* ``{"hurst": [0, 1, "oo"], "len_low": [0, 1000, "cc"]}``
Expand All @@ -325,7 +325,7 @@ def default_opt_arg_bounds(self):
return {"hurst": [0, 1, "oo"], "len_low": [0, 1000, "cc"]}

def correlation(self, r):
r"""Truncated-Power-Law with Exponential modes - correlation function
r"""Truncated-Power-Law with Exponential modes - correlation function.
If ``len_low=0`` we have a simple representation:
Expand Down Expand Up @@ -362,7 +362,7 @@ def correlation(self, r):


class TPLStable(CovModel):
r"""Truncated-Power-Law with Stable modes
r"""Truncated-Power-Law with Stable modes.
Notes
-----
Expand Down Expand Up @@ -453,14 +453,14 @@ class TPLStable(CovModel):

@property
def len_up(self):
""":class:`float`: The upper length scale truncation of the model.
""":class:`float`: Upper length scale truncation of the model.
* ``len_up = len_low + len_scale``
"""
return self.len_low + self.len_scale

def var_factor(self):
r"""Factor for C (Power-Law factor) to result in variance
r"""Factor for C (Power-Law factor) to result in variance.
This is used to result in the right variance, which is depending
on the hurst coefficient and the length-scale extents
Expand All @@ -478,7 +478,7 @@ def var_factor(self):
) / (2 * self.hurst)

def default_opt_arg(self):
"""The defaults for the optional arguments:
"""Defaults for the optional arguments.
* ``{"hurst": 0.5, "alpha": 1.5, "len_low": 0.0}``
Expand All @@ -490,7 +490,7 @@ def default_opt_arg(self):
return {"hurst": 0.5, "alpha": 1.5, "len_low": 0.0}

def default_opt_arg_bounds(self):
"""The defaults boundaries for the optional arguments:
"""Defaults for boundaries of the optional arguments.
* ``{"hurst": [0, 1, "oo"], "alpha": [0, 2, "oc"], "len_low": [0, 1000, "cc"]}``
Expand All @@ -506,7 +506,7 @@ def default_opt_arg_bounds(self):
}

def check_opt_arg(self):
"""Checks for the optional arguments
"""Check the optional arguments.
Warns
-----
Expand All @@ -521,7 +521,7 @@ def check_opt_arg(self):
)

def correlation(self, r):
r"""Truncated-Power-Law with Stable modes - correlation function
r"""Truncated-Power-Law with Stable modes - correlation function.
If ``len_low=0`` we have a simple representation:
Expand Down
Loading

0 comments on commit 4f2c45c

Please sign in to comment.