residual

hep_spt.residual(vals, err, ref, ref_err=None)[source]

Calculate the residual with its errors, for a set of values with respect to a reference. If uncertainties are also provided for the reference, then the definition is the same but considering the sum of squares rule:

\[(\sigma'^{v}_{low})^2 = (\sigma^{v}_{low})^2 + (\sigma^{r}_{up})^2\]
\[(\sigma'^{v}_{up})^2 = (\sigma^{v}_{up})^2 + (\sigma^{r}_{low})^2\]
Parameters
  • vals (numpy.ndarray) – values to compare with.

  • err (numpy.ndarray) – array of errors. Both symmetric and asymmetric errors can be provided. In the latter case, they must be provided as a (2, n) array.

  • ref (numpy.ndarray) – reference to follow.

  • ref_err (numpy.ndarray) – possible errors for the reference.

Returns

Residual of the values with respect to the reference and associated errors. In case asymmetric errors have been provided, the returning array has shape (2, n).

Return type

numpy.ndarray, numpy.ndarray

Raises

TypeError – if any of the error arrays does not have shape (2, n) or (n,).

See also

pull()