PyTorch single/multi-grain refiner (drop-in replacement for FitPosOrStrainsOMP / FitPosOrStrainsGPU)
Project description
midas-fit-grain
PyTorch single- and multi-grain refiner. Drop-in replacement for the C executables
FitPosOrStrainsOMP / FitPosOrStrainsGPU in MIDAS FF-HEDM.
Status: pre-alpha (under development). The C path remains the ff_MIDAS default;
this package is opt-in via --refine-backend python.
What it does
For each grain in SpotsToIndex.csv:
- Reads matched spots from
ExtraInfo.binand the seed orientation fromBestPos_*.csv(the indexer's per-spot output). - Refines 12 parameters: position (3) + Bunge Euler (3) + lattice (6).
- Writes byte-identical
OrientPosFit.bin/FitBest.bin/Key.binconsumed by the existingff_MIDAS.pymerge stage.
Solvers
--solver {lbfgs,adam,lm,nelder_mead} — default lbfgs.
Loss functions
--loss {pixel,angular,internal_angle} — default pixel.
| Loss | Residual | Equivalent C function |
|---|---|---|
pixel |
(y, z) pixel positions on detector |
FitErrorsPosT (FitPosOrStrainsOMP) |
angular |
(2θ, η, ω) in radians |
optimize_single_grain (midas-diffract) |
internal_angle |
angle between ĝ_pred and ĝ_obs (rad) |
CalcInternalAngle (FitOrientationOMP) |
Fit modes
--mode {iterative,all_at_once} — default iterative.
iterative: position → re-match → orientation → re-match → strain → re-match → joint polish (matchesFitPosOrStrainsOMPdefault behavior).all_at_once: 12 params jointly, association computed once at entry, no mid-fit re-match.
Backends
MIDAS_FIT_GRAIN_DEVICE and MIDAS_FIT_GRAIN_DTYPE follow the same precedence
contract as midas-index (cuda > mps > cpu auto-detect; f64 on CPU,
f32 on accelerators). Per-grain refinement is batched into a single forward
call across the block, so scaling depends on B × S (grains × spots/grain),
not per-grain Python overhead.
CLI
midas-fit-grain paramstest.txt <blockNr> <numBlocks> <numLines> <numProcs> \
[--solver lbfgs] [--loss pixel] [--mode iterative]
Argv shape mirrors the C binary so the ff_MIDAS subprocess line is one-for-one.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file midas_fit_grain-0.1.0.tar.gz.
File metadata
- Download URL: midas_fit_grain-0.1.0.tar.gz
- Upload date:
- Size: 60.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6485bb57f660ab9bfdf2fcf53c75598310c78b4d77d3da70e5ee760bc2d7e29d
|
|
| MD5 |
c33e2c8c68252228050f4a609de04467
|
|
| BLAKE2b-256 |
58d595d274abfbb1f9dda904764715e932ccb5f069d104f148db5640e37a344a
|
Provenance
The following attestation bundles were made for midas_fit_grain-0.1.0.tar.gz:
Publisher:
python-packages.yml on marinerhemant/MIDAS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
midas_fit_grain-0.1.0.tar.gz -
Subject digest:
6485bb57f660ab9bfdf2fcf53c75598310c78b4d77d3da70e5ee760bc2d7e29d - Sigstore transparency entry: 1446513591
- Sigstore integration time:
-
Permalink:
marinerhemant/MIDAS@360096912e32ed91a9ac78f15b297ef248dc96de -
Branch / Tag:
refs/tags/midas-fit-grain-v0.1.0 - Owner: https://github.com/marinerhemant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-packages.yml@360096912e32ed91a9ac78f15b297ef248dc96de -
Trigger Event:
release
-
Statement type:
File details
Details for the file midas_fit_grain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: midas_fit_grain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 60.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9886cafdd5ed0e658770024bf9e08b3c7b0e2c2bebc32f0e4d2a21279ce90e97
|
|
| MD5 |
a1dd7ca5d4e723d485910c00f00ed50b
|
|
| BLAKE2b-256 |
27c7041fe3fe106e9392f011f4675965e09535b8636edb996888d298a1f9137a
|
Provenance
The following attestation bundles were made for midas_fit_grain-0.1.0-py3-none-any.whl:
Publisher:
python-packages.yml on marinerhemant/MIDAS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
midas_fit_grain-0.1.0-py3-none-any.whl -
Subject digest:
9886cafdd5ed0e658770024bf9e08b3c7b0e2c2bebc32f0e4d2a21279ce90e97 - Sigstore transparency entry: 1446513666
- Sigstore integration time:
-
Permalink:
marinerhemant/MIDAS@360096912e32ed91a9ac78f15b297ef248dc96de -
Branch / Tag:
refs/tags/midas-fit-grain-v0.1.0 - Owner: https://github.com/marinerhemant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-packages.yml@360096912e32ed91a9ac78f15b297ef248dc96de -
Trigger Event:
release
-
Statement type: