plag — diffusion modeling in plagioclase
A Python library for building and running trace-element diffusion models in plagioclase feldspar.
For complete documentation please see vsc.code-pages.usgs.gov/petro/tools/plag.
docs only available on internal USGS network for now, but will be made public in the future
Motivation
Diffusion chronometry in plagioclase is a powerful tool for constraining the timescales of magmatic processes. It is fairly ubiquitous in igneous systems, crystallizing over a wide range of $P-T-X-fO_2$ conditions, and has chronometers that span orders of magnitude allowing for the quantification of a range of timescales (i.e., days - millennia). Furthermore, many parameters to help aid in petrologic investigations (partition coefficients for calculating melt composition proxies) and diffusion studies (diffusion coefficients) can be calculated by only having knowledge of the plagioclase composition, temperature, and basic melt composition, making it a powerful tool in the petrologist toolkit. This, however, is where the fun seemingly ends. While these observations are incredibly useful, their numerical implementation is not exactly straightforward, and setting up forward diffusion models involves many interrelated steps: choosing partitioning and diffusivity models, constructing initial profiles, running finite-difference simulations, and propagating analytical and temperature uncertainties through Monte Carlo resampling.
plag wraps this entire workflow into a single, coherent API so that you can focus on the science rather than the bookkeeping.
Goals
- Provide a structured, reproducible workflow for calculations involving trace-element diffusion modeling in plagioclase.
- Make it easy to compare different partitioning and diffusivity parameterisations from the literature.
- Propagate uncertainties rigorously via Monte Carlo methods with random sampling that incorporates the covariance structure of the data that determines all the parameters utilized in the random sampling (e.g., $RT\ln{K_d} = A(\pm \sigma_A)\cdot X_{An} + B(\pm \sigma_B)$).
- Take advantage of
numbaaccelerated finite-difference solvers for fast forward modeling on a standard personal computer.
Installation
It is recommended to do this in a fresh virtual environment:
# Create a virtual environment (conda example)
conda create -n diffusion-modeling python=3.13
conda activate diffusion-modeling
# Install from PyPI
pip install plagioclase
# Install from source
git clone https://code.usgs.gov/vsc/petro/tools/plag.git
cd plag
pip install .
For development (includes pytest, pytest-cov, ruff):
pip install -e ".[dev]"
Citation
If you use plag in your research, please cite it:
Lubbers, J. (2026)
plag, version 1.0.0: U.S. Geological Survey software release https://doi.org/10.5066/P13OEK4A
To do
See todo.md for the full list of outstanding work items, each annotated with implementation guidance.
Metadata
Release files for plagioclase 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plagioclase-1.0.0.tar.gz | 87.6 kB | Without provenance | Details for plagioclase-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plagioclase-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for plagioclase-1.0.0-py3-none-any.whl |
Total release size: 179.6 kB
Release files / plagioclase-1.0.0.tar.gz
| Download URL | plagioclase-1.0.0.tar.gz |
|---|---|
| Size | 87.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4325e7085a09e4caf8c944ef08cbc229ca0d06538b4964f9ca125cbc0933a335
|
|
BLAKE2b-256 checksum How to use checksums |
b90679973252efe119ea3fac21a4fa9d9cf04a99e2f2225d05f0a652bbd8f1d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / plagioclase-1.0.0-py3-none-any.whl
| Download URL | plagioclase-1.0.0-py3-none-any.whl |
|---|---|
| Size | 92.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d236fcc45cf03f635315aa791dc90ff3f24591c4b80e398d1cc68c03518a7790
|
|
BLAKE2b-256 checksum How to use checksums |
d625c66d2f0861136ed4ce32cd99d5edddf242da5cab7b860f4ce44111f503b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Security for plagioclase 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.