Metadata-Version: 2.4
Name: midas-invert
Version: 0.1.0
Summary: Domain-agnostic differentiable-inversion primitives for MIDAS: gradient fitting, scale-invariant losses, Laplace uncertainty, Fisher-information experiment design, mixture deconvolution, and amortised-inference surrogates.
Author-email: Hemant Sharma <hsharma@anl.gov>
License-Expression: BSD-3-Clause
Classifier: Development Status :: 2 - Pre-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.20
Requires-Dist: torch>=2.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# midas-invert

Domain-agnostic **differentiable-inversion primitives** for MIDAS, shared across
HEDM, Laue microdiffraction, pf-/grain-ODF, and 2D/ultrafast diffraction. None of
it knows about diffraction — you supply the forward model and the loss closure.

- **`optimize`** — `fit` (Adam / L-BFGS), `relative_l2_loss` (scale-robust),
  `cosine_loss` (scale-invariant shape loss; avoids the argmax kink of
  peak-normalisation — right for rocking curves, fringe profiles, spectra).
- **`uq`** — `laplace_uncertainty` (Hessian-at-optimum covariance & std-devs).
- **`design`** — `fisher_information`, `rank_measurements`, `next_best_measurement`
  (which delay / reflection / energy best constrains a target — experiment design).
- **`mixture`** — `mixture_deconvolution` (recover non-negative softmax weights
  over a component grid: thickness/grain-size distributions, ODF on a grid, a
  spectrum over an energy grid).
- **`surrogate`** — `ParameterMLP`, `train_surrogate` (amortised inference; the
  differentiable forward is the data generator).

All torch-differentiable, CPU / CUDA / MPS. Extracted from `midas_2d` so HEDM,
Laue, and 2D draw on one implementation (see `../HEDM_LAUE_TRANSFER_PLAN.md`).

```bash
pip install -e . --no-deps
KMP_DUPLICATE_LIB_OK=TRUE pytest
```
