Skip to main content

For modeling diffusion in plagioclase

Project description

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

  1. Provide a structured, reproducible workflow for calculations involving trace-element diffusion modeling in plagioclase.
  2. Make it easy to compare different partitioning and diffusivity parameterisations from the literature.
  3. 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)$).
  4. Take advantage of numba accelerated 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plagioclase-1.0.0.tar.gz (87.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plagioclase-1.0.0-py3-none-any.whl (92.1 kB view details)

Uploaded Python 3

File details

Details for the file plagioclase-1.0.0.tar.gz.

File metadata

  • Download URL: plagioclase-1.0.0.tar.gz
  • Upload date:
  • Size: 87.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for plagioclase-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4325e7085a09e4caf8c944ef08cbc229ca0d06538b4964f9ca125cbc0933a335
MD5 e60d4cf4ca8d0eecc200edd209d98159
BLAKE2b-256 b90679973252efe119ea3fac21a4fa9d9cf04a99e2f2225d05f0a652bbd8f1d2

See more details on using hashes here.

File details

Details for the file plagioclase-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: plagioclase-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 92.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for plagioclase-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d236fcc45cf03f635315aa791dc90ff3f24591c4b80e398d1cc68c03518a7790
MD5 8d42413c7b39f803df9e2853d775c6f9
BLAKE2b-256 d625c66d2f0861136ed4ce32cd99d5edddf242da5cab7b860f4ce44111f503b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page