mescla.uncertainty.montecarlo.monte_carlo_ratios

mescla.uncertainty.montecarlo.monte_carlo_ratios(endmembers, samples, sd_endmembers=None, sd_samples=None, n_draws=2000, endmember_cov=None, percentiles=(2.5, 97.5), seed=0)[source]

Percentile intervals on mixing ratios by resampling the inputs.

Parameters:
  • endmembers (array_like, DataFrame or ChemTable)

  • samples (array_like, DataFrame or ChemTable)

  • sd_endmembers (array_like, optional) – Standard deviations; fall back to the sigma carried by the inputs.

  • sd_samples (array_like, optional) – Standard deviations; fall back to the sigma carried by the inputs.

  • n_draws (int, default 2000)

  • endmember_cov (ndarray, shape (ns, ns), optional) – Covariance between species within an end-member. Supplying it matters: drawing each species independently pretends that an end-member can be simultaneously chloride-rich and sodium-poor, which real waters are not, and that generally inflates the intervals.

  • percentiles (tuple of float, default (2.5, 97.5))

  • seed (int, optional)

Returns:

dictmean, median, sd, lower, upper – each of shape (n_samples, ne) – plus the full draws array (n_draws, n_samples, ne).