Metadata-Version: 2.4
Name: plagioclase
Version: 1.0.0
Summary: For modeling diffusion in plagioclase
Project-URL: Homepage, https://vsc.code-pages.usgs.gov/petro/tools/plag
Project-URL: Repository, https://code.usgs.gov/vsc/petro/tools/plag
Author-email: Jordan Lubbers <jelubber@gmail.com>
License: License
        =======
        
        Unless otherwise noted, This project is in the public domain in the United
        States because it contains materials that originally came from the United
        States Geological Survey, an agency of the United States Department of
        Interior. For more information, see the official USGS copyright policy at
        https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits
        
        Additionally, we waive copyright and related rights in the work
        worldwide through the CC0 1.0 Universal public domain dedication.
        
        
        CC0 1.0 Universal Summary
        -------------------------
        
        This is a human-readable summary of the
        [Legal Code (read the full text)][1].
        
        
        ### No Copyright
        
        The person who associated a work with this deed has dedicated the work to
        the public domain by waiving all of his or her rights to the work worldwide
        under copyright law, including all related and neighboring rights, to the
        extent allowed by law.
        
        You can copy, modify, distribute and perform the work, even for commercial
        purposes, all without asking permission.
        
        
        ### Other Information
        
        In no way are the patent or trademark rights of any person affected by CC0,
        nor are the rights that other persons may have in the work or in how the
        work is used, such as publicity or privacy rights.
        
        Unless expressly stated otherwise, the person who associated a work with
        this deed makes no warranties about the work, and disclaims liability for
        all uses of the work, to the fullest extent permitted by applicable law.
        When using or citing the work, you should not imply endorsement by the
        author or the affirmer.
        
        
        
        [1]: https://creativecommons.org/publicdomain/zero/1.0/legalcode
        
License-File: LICENSE
Keywords: diffusion modeling,geochemistry,plagioclase,trace elements
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: joblib>=1.3
Requires-Dist: matplotlib>=3.7
Requires-Dist: numba>=0.58
Requires-Dist: numpy>=1.24
Requires-Dist: openpyxl>=3.1
Requires-Dist: pandas>=2.0
Requires-Dist: scipy>=1.10
Requires-Dist: statsmodels>=0.14
Requires-Dist: tqdm>=4.60
Provides-Extra: dev
Requires-Dist: arviz>=0.15; extra == 'dev'
Requires-Dist: lasertram; extra == 'dev'
Requires-Dist: pymc>=5.0; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-jupyter; extra == 'docs'
Requires-Dist: mkdocs-material<10,>=9.7.5; extra == 'docs'
Requires-Dist: mkdocs<2,>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]; extra == 'docs'
Description-Content-Type: text/markdown

# `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](https://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:

```bash
# 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):

```bash
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](todo.md) for the full list of outstanding work items, each annotated with implementation guidance.

