Metadata-Version: 2.4
Name: midas-propagate
Version: 0.1.1
Summary: End-to-end uncertainty propagation and joint re-refinement for HEDM (calibration -> indexing -> per-grain refinement -> stress)
Author-email: Hemant Sharma <hsharma@anl.gov>
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/marinerhemant/MIDAS
Project-URL: Issues, https://github.com/marinerhemant/MIDAS/issues
Keywords: HEDM,3DXRD,uncertainty quantification,calibration,joint refinement,Laplace,Schur complement,PyTorch,crystallography,polycrystal,grain
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.22
Requires-Dist: torch>=2.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"

# midas-propagate

Calibration-aware uncertainty propagation and joint re-refinement
for end-to-end HEDM grain analysis.

**Status:** scaffold. See [`dev/paper/SKETCH.md`](dev/paper/SKETCH.md)
for the paper roadmap. No working code yet.

## Notebooks

Worked-example Jupyter notebooks live in `notebooks/`. They are **not shipped with `pip install`** — get them by cloning the [MIDAS repository](https://github.com/marinerhemant/MIDAS/tree/master/packages/midas_propagate/notebooks).

## What this package will do

1. Compose the existing differentiable losses across the four
   pipeline stages — calibration (`midas-calibrate-v2`), indexing
   (`midas-index`), per-grain refinement (`midas-fit-grain`), and
   elastic inversion (`midas-stress`) — into a single joint NLL.

2. Compute a joint MAP estimate over any subset of:
   - detector calibration (Lsd, tilts, beam center, distortion)
   - per-grain orientation, lattice strain, position
   - global nuisance parameters (wavelength, beam profile)
   - optionally per-grain elastic stress

3. Assemble the block-structured Hessian at MAP and return
   **calibration-aware per-grain covariance** via Schur-complement
   marginalization — no full-matrix inverse needed.

4. Propagate per-grain covariance through the elastic inversion to
   per-grain stress error bars via the delta method.

## Why

Production HEDM tools (HEXRD, MIDAS, ImageD11, FABLE) report per-grain
σ at the converged grain state with detector calibration **held
fixed**. Downstream Bayesian crystal-plasticity work (Greeley 2026,
Iyer 2025) explicitly assumes an HEDM σ no current tool can derive.
This package closes that loop.

## Companion packages

- `midas-diffract` — differentiable HEDM forward model
- `midas-uq` — single-grain holdout / jackknife / Laplace UQ
- `midas-joint-ff-calibrate` — multi-grain + multi-detector joint refinement
- `midas-calibrate-v2` — instrument calibration
- `midas-stress` — single-crystal elastic inversion
