qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec.models. reduced_chi2  (  model ,  x ,  y ,  sigma_y  )[source]

The reduced $\chi^2$ of a model with its current parameter values model.vals

$$ \chi^2_\mathrm{red} = \frac{1}{N - n}\sum\limits_{i=1}^N \left(\frac{y_i - f(x_i)}{\sigma_{y,i}}\right)^2, $$

where $N$ is the number of data points and $n$ the number of free parameters.

Parameters:
model_base.Model

The Model $f$.

xndarray

The x data.

yndarray

The y data.

sigma_yndarray

The uncertainties of the y data.

Returns:
red_chi2float

The reduced $\chi^2$.