detectorErrMC

fiducia.error.detectorErrMC(detArr, detArrVariance, samples=10000, boundary='y0', MChistogram=False)[source]

Monte Carlo simulation and statistics to determine cubic spline uncertainty.

Calculate the cubic spline matrix uncertainty using a Monte Carlo simulation and statistics on the MC’s output.

Parameters
  • detArr (numpy.ndarray) – Matrix representing the spectrally integrated folding of the detector response with a cubic spline interpolation of the x-ray spectrum. See ‘cspline.detectorArr()’.

  • detArrVariance (numpy.ndarray) – A DataFrame containing the uncertainty for each Dante channel for the photon energy range that detArr spans.

  • samples (int, optional) – Number of MCs amples to run. Default is 10000.

  • boundary (str, optional) – Choose whether yGuess corresponds to \(y_0\) (lowest photon energy) or \(y_{n+1}\) (highest photon energy) boundary condition. This should correspond to the photon energy value given in knots. Options are y0 or yn+1. Default is ‘y0’.

  • MChistogram (bool, optional) – Plot histograms corresponding to each variant of detArr generated with Monte Carlo uncertainty propagation. Default is False.

Returns

stdErrorMatrix – A numpy.ndarray with the standard deviation of the inverted matrices generated using random weights based on the channel uncertainty.

Return type

numpy.ndarray

Raises
  • Exception – If boundary doesn’t equal y0 or yn+1.

  • ValueError – If the shapes of detArr and detUncertaintyArr aren’t equal.

Notes

Examples