Mescla

End-Member Mixing Analysis (EMMA) and water mixing-ratio methods for hydrochemistry, with a test suite that reproduces published results.

Two method families, used together:

EMMA

Mixing ratios

Answers

How many end-members are needed, and which species behave as a mixture

In what proportions those end-members mix in each sample

Machinery

Eigen-analysis of standardised chemistry; projection into U-space

Constrained least squares, or maximum likelihood when end-members are uncertain

Cannot

give you mixing ratios

tell you whether your conceptual model is right

Key refs

Christophersen & Hooper (1992); Hooper (2003)

Carrera et al. (2004)

The whole pipeline
import mescla as am
from mescla.datasets import make_mixture

data = make_mixture(n_endmembers=3, n_species=5, n_samples=60, seed=0)

model = am.EMMA().fit(data.samples)     # we do not tell it the answer
print(model.n_endmembers)               # 3

result = am.mixing_ratios(data.endmembers, data.samples)
result.ratios_frame().head()

Getting started

Acknowledgements

Mescla was developed at Amphos 21 Consulting S.L., which funded the work. The methods themselves come from different References.

License and citation

The code is MIT licensed; the bundled datasets carry their own terms, recorded in src/mescla/datasets/data/SOURCES.md.

If Mescla is useful in your work, please cite it. CITATION.cff in the repository root has the software citation in machine-readable form, and References lists the methods papers it implements — see Citing Mescla there.