nifty7.library.special_distributions module#

InverseGammaOperator(domain, alpha, q, delta=0.01)[source]#

Transform a standard normal into an inverse gamma distribution.

The pdf of the inverse gamma distribution is defined as follows:

\frac{q^\alpha}{\Gamma(\alpha)}x^{-\alpha -1}
\exp \left(-\frac{q}{x}\right)

That means that for large x the pdf falls off like x^(-\alpha -1). The mean of the pdf is at q / (\alpha - 1) if \alpha > 1. The mode is q / (\alpha + 1).

This transformation is implemented as a linear interpolation which maps a Gaussian onto an inverse gamma distribution.

Parameters:
  • domain (Domain, tuple of Domain or DomainTuple) – The domain on which the field shall be defined. This is at the same time the domain and the target of the operator.

  • alpha (float) – The alpha-parameter of the inverse-gamma distribution.

  • q (float or Field) – The q-parameter of the inverse-gamma distribution.

  • delta (float) – Distance between sampling points for linear interpolation.

class LaplaceOperator(domain, loc=0, scale=1)[source]#

Bases: Operator

Transform a standard normal to a Laplace distribution.

Parameters:
  • domain (Domain, tuple of Domain or DomainTuple) – The domain on which the field shall be defined. This is at the same time the domain and the target of the operator.

  • loc (float) –

  • scale (float) –

apply(x)[source]#

Applies the operator to a Field or MultiField.

Parameters:

x (Field or MultiField) – Input on which the operator shall act. Needs to be defined on domain.

inverse(x)[source]#
LogInverseGammaOperator(domain, alpha, q, delta=0.01)[source]#

Transform a standard normal into the log of an inverse gamma distribution.

class UniformOperator(domain, loc=0, scale=1)[source]#

Bases: Operator

Transform a standard normal into a uniform distribution.

The uniform distribution’s support is [loc, loc + scale].

Parameters:
  • domain (Domain, tuple of Domain or DomainTuple) – The domain on which the field shall be defined. This is at the same time the domain and the target of the operator.

  • loc (float) –

  • scale (float) –

apply(x)[source]#

Applies the operator to a Field or MultiField.

Parameters:

x (Field or MultiField) – Input on which the operator shall act. Needs to be defined on domain.

inverse(field)[source]#