Transform 22

Spectral methods

%matplotlib widget
import matplotlib.pyplot as plt
# turn of warnings
import warnings

The spectrum of a covariance model is given by:

S(k)=(12π)nC(r)eibkrdnr\begin{align}S(\mathbf{k}) = \left(\frac{1}{2\pi}\right)^n \int C(\Vert\mathbf{r}\Vert) e^{i b\mathbf{k}\cdot\mathbf{r}} d^n\mathbf{r}\end{align}

Since the covariance function C(r)C(r) is radially symmetric, we can calculate this by the hankel-transformation:

S(k)=(12π)n(2π)n/2(bk)n/210rn/21C(r)Jn/21(bkr)rdr\begin{align}S(k) = \left(\frac{1}{2\pi}\right)^n \cdot \frac{(2\pi)^{n/2}}{(bk)^{n/2-1}} \int_0^\infty r^{n/2-1} C(r) J_{n/2-1}(bkr) r dr\end{align}

Where k=kk=\left\Vert\mathbf{k}\right\Vert.

Depending on the spectrum, the spectral-density is defined by:

S~(k)=S(k)σ2\begin{align}\tilde{S}(k) = \frac{S(k)}{\sigma^2}\end{align}

You can access these methods by:

import gstools as gs

model = gs.Gaussian(dim=3, var=2.0, len_scale=10)
ax = model.plot("spectrum")
model.plot("spectral_density", ax=ax)


The spectral-density is given by the radius of the input phase. But it is not a probability density function for the radius of the phase.

To obtain the pdf for the phase-radius, you can use the methods CovModel.spectral_rad_pdf or CovModel.ln_spectral_rad_pdf for the logarithm.

The user can also provide a cdf (cumulative distribution function) by defining a method called spectral_rad_cdf and/or a ppf (percent-point function) by spectral_rad_ppf.

The attributes CovModel.has_cdf and CovModel.has_ppf will check for that.