paramagpy.fit.fit_error_monte_carlo

paramagpy.fit.fit_error_monte_carlo(fittingFunction, iterations, **kwargs)[source]

Perform uncertainty analysis sourcing noise from experimental uncertainties This function takes a fitting routine <fittingFunction> and repeats it for the specified iterations in a Monte-Carlo approach. With each iteration, random noise sourced from a uniform distribution scaled by the experimental uncertainties is added to the experimental values. The standard deviation in the fitted parameters is then returned.

NOTE: the ‘err’ column of the dataArrays must be set to non-zero values for this method to work.

Parameters
  • fittingFunction (function) – the fitting routine to be used. This could be ‘nlr_fit_metal_from_ccr’ for example

  • iterations (int) – the number of iterations for the Monte-Carlo simulation

  • kwargs (dict) – all key-word arguments will be bundled into this variable and parsed to the fittingFunction.

Returns

  • sample_metals (list of list of metals) – the metals fitted to the data with noise at each iteration

  • std_metals (list of metals) – the standard deviation in fitted parameters over all iterations of the Monte Carlo simulation. These are stored within the metal object. All unfitted parameters are zero.