mcsas.mcsas.backgroundscalingfit module

class BackgroundScalingFit(findBackground, *args)[source]

Bases: object

Chi-squared convergence calculation happens here. Optimizes the scaling and background factor to match intCalc closest to intObs. Returns an array with scaling factors. Input initial guess sc has to be a two-element array with the scaling and background.

Input arguments:

Parameters:
  • intObs – An array of measured, respectively observed intensities
  • intCalc – An array of intensities which should be scaled to match intObs
  • intError – An array of uncertainties to match intObs
  • sc – A 2-element array of initial guesses for scaling factor and background
  • ver(optional) Can be set to 1 for old version, more robust but slow, default 2 for new version, 10x faster than version 1, requires decent starting values
  • outputIntensity(optional) Return the scaled intensity as third output argument, default: False
  • background(optional) Enables a flat background contribution, default: True
Returns:

(sc, conval): A tuple of an array containing the intensity scaling factor and background and the reduced chi-squared value.

static aGoFsAlpha(dataMeas, dataErr, dataCalc)[source]

The alternative Goodness-of-Fit value without alpha, i.e. multiplied by alpha, according to [Henn 2016] ( http://dx.doi.org/10.1107/S2053273316013206 ).

calc(data, modelData, sc, ver=2)[source]

Warning

method ‘mcsas.backgroundscalingfit.BackgroundScalingFit.calc’ undocumented

static chi(sc, dataMeas, dataErr, dataCalc)[source]

Chi calculation, difference of measured and calculated signal.

static chiNoBg(sc, dataMeas, dataErr, dataCalc)[source]

Chi calculation, difference of measured and calculated signal, scaling only, no backgrund.

static chiSqr(dataMeas, dataErr, dataCalc)[source]

Reduced Chi-squared calculation, size of parameter-space not taken into account; for data with known intError.

dataScaled(data, sc)[source]

Returns the input data scaled by the provided factor and background level applied if requested.

fitLM(dataMeas, dataErr, dataCalc, sc)[source]

Warning

method ‘mcsas.backgroundscalingfit.BackgroundScalingFit.fitLM’ undocumented

fitSimplex(dataMeas, dataErr, dataCalc, sc)[source]

Warning

method ‘mcsas.backgroundscalingfit.BackgroundScalingFit.fitSimplex’ undocumented