FitMeasurement

class nexus.FitMeasurement(*args, **kwargs)

Bases: Measurement

Abstract class for all fittable measurement class objects. Do not initialize this method, use the derived classes.

Parameters:
  • id (string) – String identifier.

  • experiment (Experiment) – Experiment.

  • detuning (list) – Detuning values for nuclear calculation.

  • time (list) – Time values for nuclear calculation which depend on time.

  • distribution_points (int) – Number of distribution_points for objects in forward geometry.

  • data_size (int) – Number of data points of experimental data.

  • scaling (Var) – Intensity scaling factor for fitting.

  • background (Var) – Background for fitting.

  • offset (Var) –

    Offset in the x axis.

    Added in version 1.1.0.

  • fit_weight (float) – Relative weight for the cost function in multi measurement fitting. Default is 1.

  • resolution (Var) – FWHM of the convolution kernel.

  • resolution_2 (Var) – FWHM of the convolution kernel along the second axis in 2D data sets.

  • kernel_type (string) – The kernel used for the convolution, either Gauss or Lorentz.

data_size

Number of data points of experimental data.

Type:

int

scaling

Intensity scaling factor for fitting.

Type:

Var

background

Background for fitting.

Type:

Var

offset

Offset in the x axis.

Added in version 1.1.0.

Type:

Var

fit_weight

Relative weight for the cost function in multi measurement fitting. Default is 1.

Type:

float

resolution

FWHM of the convolution kernel.

Type:

Var

resolution_2

FWHM of the convolution kernel along the second axis in 2D data sets.

Type:

Var

kernel_type

The kernel used for the convolution, either “Gauss” or “Lorentz”.

Type:

string

squared_residuals

Sum of the squared residuals. Calculated during fitting.

Removed in version 2.0.0.

Type:

float

sum_user_residuals

Sum of the residuals provided by the user (with exponent used). Calculated during fitting.

Added in version 2.0.0.

Type:

float

fit_residuals

The residuals from the Residual function used during fitting fit. Calculated during fitting.

Added in version 1.0.3.

Type:

array

bare_residuals

The difference residuals (:math:`x_i - y_i) from the fit. Calculated during fitting.

Added in version 1.1.0.

Type:

array

Cost()

Get the cost function of the measurement

\[cost = \frac{1}{n} \sum_i r(y_i, \hat{y}_i)\]

Added in version 2.0.0.

Returns:

cost function value.

Return type:

float

MeanSquaredError()

Get the mean squared error (MSE) of the measurement

\[cost = \frac{1}{n} \sum_i (y_i - \hat{y}_i)^2\]

Added in version 2.0.0.

Returns:

MSE value.

Return type:

float

class nexus.FitMeasurementVector(*args)

Bases: object

List of FitMeasurement objects.