edges_cal.modelling.ModelFit

class edges_cal.modelling.ModelFit(model: FixedLinearModel, ydata: ndarray, weights: ndarray | float = 1.0)[source]

A class representing a fit of model to data.

Parameters:
  • model (edges_cal.modelling.FixedLinearModel) – The evaluatable model to fit to the data.

  • ydata (numpy.ndarray) – The values of the measured data.

  • weights (numpy.ndarray | float) – The weight of the measured data at each point. This corresponds to the variance of the measurement (not the standard deviation). This is appropriate if the weights represent the number of measurements going into each piece of data.

Raises:

ValueError – If model_type is not str, or a subclass of Model.

Methods

__init__(model, ydata[, weights])

Method generated by attrs for class ModelFit.

evaluate([x])

Evaluate the best-fit model.

get_sample([size])

Generate a random sample from the posterior distribution.

reduced_weighted_chi2()

The weighted chi^2 divided by the degrees of freedom.

weighted_rms()

The weighted root-mean-square of the residuals.

Attributes

degrees_of_freedom

The number of degrees of freedom of the fit.

fit

A model that has parameters set based on the best fit to this data.

hessian

The Hessian matrix of the linear parameters.

model_parameters

The best-fit model parameters.

parameter_covariance

The Covariance matrix of the parameters.

residual

Residuals of data to model.

weighted_chi2

The chi^2 of the weighted fit.

model

ydata

weights