SpectralShapeSkewedGaussian

class glotaran.builtin.models.spectral.shape.SpectralShapeSkewedGaussian[source]

Bases: object

A (skewed) Gaussian spectral shape

Attributes Summary

amplitude

label

location

skewness

type

width

Methods Summary

calculate

Calculate a (skewed) Gaussian shape for a given axis.

calculate_gaussian

Calculate a normal Gaussian shape for a given axis.

calculate_skewed_gaussian

Calculate the skewed Gaussian shape for axis.

fill

Returns a copy of the {cls._name} instance with all members which are Parameters are replaced by the value of the corresponding parameter in the parameter group.

from_dict

from_list

mprint

validate

Methods Documentation

property amplitude: glotaran.parameter.parameter.Parameter
calculate(axis: numpy.ndarray) numpy.ndarray[source]

Calculate a (skewed) Gaussian shape for a given axis.

If a non-zero skewness parameter was added calculate_skewed_gaussian() will be used. Otherwise it will use calculate_gaussian().

Parameters

axis (np.ndarray) – The axis to calculate the shape for.

Returns

shape – A Gaussian shape.

Return type

numpy.ndarray

Note

Internally axis is converted from \mbox{nm} to 1/\mbox{cm}, thus location and width also need to be provided in 1/\mbox{cm} (1e7/value_in_nm).

calculate_gaussian(axis: numpy.ndarray) numpy.ndarray[source]

Calculate a normal Gaussian shape for a given axis.

The following equation is used for the calculation:

f(x, A, x_0, \Delta) = A \exp \left({-
\frac{
    \log{\left(2 \right)
    \left(2(x - x_{0})\right)^{2}
}}{\Delta^{2}}}\right)

The parameters of the equation represent the following attributes of the shape:

  • x : axis

  • A : amplitude

  • x_0 : location

  • \Delta : width

In this formalism, \Delta represents the full width at half maximum (FWHM). Compared to the more common definition \exp \left(- (x-\mu )^{2}/(2\sigma^{2})\right) we have \sigma = \Delta/(2\sqrt{2\ln(2)})=\Delta/2.35482

Parameters

axis (np.ndarray) – The axis to calculate the shape for.

Returns

An array representing a Gaussian shape.

Return type

np.ndarray

calculate_skewed_gaussian(axis: numpy.ndarray) numpy.ndarray[source]

Calculate the skewed Gaussian shape for axis.

The following equation is used for the calculation:

f(x, x_0, A, \Delta, b) =
\left\{
    \begin{array}{ll}
        0                                               & \mbox{if } \theta \leq 0 \\
        A \exp \left({- \dfrac{\log{\left(2 \right)}
        \log{\left(\theta(x, x_0, \Delta, b) \right)}^{2}}{b^{2}}}\right)
                                                        & \mbox{if } \theta > 0
    \end{array}
\right.

With:

\theta(x, x_0, \Delta, b) = \frac{2 b \left(x - x_{0}\right) + \Delta}{\Delta}

The parameters of the equation represent the following attributes of the shape:

  • x : axis

  • A : amplitude

  • x_0 : location

  • \Delta : width

  • b : skewness

Where \Delta represents the full width at half maximum (FWHM), see calculate_gaussian().

Note that in the limit of skewness parameter b equal to zero f(x, x_0, A, \Delta, b) simplifies to a normal gaussian (since \lim_{b \to 0} \frac{\ln(1+bx)}{b}=x), see the definition in calculate_gaussian().

Parameters

axis (np.ndarray) – The axis to calculate the shape for.

Returns

An array representing a skewed Gaussian shape.

Return type

np.ndarray

fill(model: Model, parameters: ParameterGroup) cls

Returns a copy of the {cls._name} instance with all members which are Parameters are replaced by the value of the corresponding parameter in the parameter group.

Parameters
  • model – A glotaran model.

  • parameter (ParameterGroup) – The parameter group to fill from.

classmethod from_dict(values: dict) cls
classmethod from_list(values: list) cls
property label: str
property location: glotaran.parameter.parameter.Parameter
mprint(parameters: ParameterGroup = None, initial_parameters: ParameterGroup = None) str
property skewness: glotaran.parameter.parameter.Parameter
property type: str
validate(model: Model, parameters=None) list[str]
property width: glotaran.parameter.parameter.Parameter