Fit

class nexus.Fit(measurements, id='', external_fit_variables=[], inequalities=None)

Constructor for Fit class. Performs a fit of a measured data set to the given theoretical model. Local and global optimization algorithms are available. An arbitrary number of measurements can be fit simultaneously.

Parameters:
  • measurements (list) – List of FitMeasurement objects that should be fit simultaneously.

  • id (string) – User identifier.

  • external_fit_variables (list) –

    List of Var objects. These Vars are not directly assigned to a Nexus object but can be related to an equality constraint on a Var. Nexus is not able to detect those automatically, so they have to provided manually.

    New in version 1.1.0.

  • inequalities (Inequality) –

    An Inequality object. All inequalities constraints are handled by this object.

    New in version 1.1.0.

measurements

List of FitMeasurement objects that should be fit simultaneously.

Type:

list

id

User identifier.

Type:

string

external_fit_variables

List of Var objects. These Vars are not directly assigned to a Nexus object but can be related to an equality constraint on a Var. Nexus is not able to detect those automatically, so they have to provided manually.

New in version 1.1.0.

Type:

list

inequalities

An Inequality object. All inequalities constraints are handled by this object.

New in version 1.1.0.

Type:

Inequality

options

Options that specify how the fit is performed.

Type:

OptimizerOptions

initial_parameters

List with initial values of the fit parameters.

Type:

list

lower_bounds

List with min values of the fit parameters.

Type:

list

upper_bounds

List with max values of the fit parameters.

Type:

list

ids

List with ids of the fit parameters.

Type:

list

total_squared_residuals

Total sum of squared user residuals of all data provided to the Fit module.

New in version 1.1.0.

Type:

float

non_dependent_variables

Indices of parameters on which is the fit model does not depend on. Obtained from number of zero diagonal element of the covariance matrix (nan values of the correlation matrix).

New in version 1.1.0.

Type:

array

inverse_hessian

The inverse Hessian matrix of the fit parameters calculated from the ceres solver \((J*(x)J(x))^{-1}\) with \(J\) being the Jacobi matrix of the fit problem.

New in version 1.1.0.

Type:

ndarray

covariance_matrix

The covariance matrix \(C\) of the fit parameters.

New in version 1.1.0.

Type:

ndarray

correlation_matrix

The correlation matrix between the fit parameters. Calculated via the Pearson correlation coefficient \(C_{ij} / \sqrt{C_{ii} C_{jj} }\) from the covariance matrix.

New in version 1.1.0.

Type:

ndarray

fit_parameter_errors

Array with the standard deviation errors of the fit parameters.

New in version 1.1.0.

Type:

array

boostrap_fit_parameters

2D Array of all fit parameters over the number of bootstrap iterations.

New in version 1.1.0.

Type:

array

Evaluate()

Evaluates the fit. Also callable via operator ().