mescla.reactions.residuals.fit_conservative

mescla.reactions.residuals.fit_conservative(endmembers, samples, conservative, downweight=1000.0, sigma=None)[source]

Fit mixing ratios on the conservative tracers, carrying the rest along.

The correct order of operations for reaction screening: the ratios are determined by the species you trust, and every other species is then compared against the mixture those ratios predict. Non-conservative species are not dropped – they are given a standard deviation downweight times larger, so they contribute essentially nothing to the fit but still receive a prediction to be judged against.

Parameters:
  • endmembers (array_like, DataFrame or ChemTable)

  • samples (array_like, DataFrame or ChemTable)

  • conservative (sequence of str) – The species trusted to behave conservatively in this system.

  • downweight (float, default 1000.0) – Factor applied to the standard deviation of every other species. Tubau et al. (2014) used factors from 100 to 10^5.

  • sigma (array_like, optional) – Base standard deviations. Falls back to the sigma carried by samples, then to uniform.

Returns:

MixingResult – Pass it straight to classify_source_sink() or reaction_report().

Return type:

MixingResult

Examples

>>> result = fit_conservative(endmembers, samples, ["Cl", "Na", "SO4"])
>>> print(reaction_report(result, samples))