MIDAS v10+
The FF-HEDM benchmark (tests/test_ff_hedm.py) is an automated end-to-end test that validates the full FF-HEDM pipeline by:
- Running a forward simulation to generate synthetic diffraction data from known grain orientations
- Enriching the output Zarr with analysis metadata
- Running the complete
ff_MIDAS.pypipeline (peaksearch → indexing → refinement → grain list) - Verifying that the pipeline completes successfully and recovers the input grains
flowchart TD
subgraph Inputs["📂 Input Files"]
PARAMS["Parameters.txt"]
GRAINS_IN["GrainsSim.csv<br/>(3 Au grains)"]
end
subgraph Step1["Step 1: Forward Simulation"]
PARSE["Parse & rewrite paths"]
FWD["ForwardSimulationCompressed"]
PARAMS --> PARSE
GRAINS_IN --> PARSE
PARSE -->|"test_Parameters.txt"| FWD
end
subgraph Step1Out["Simulation Outputs"]
ZIP_RAW["Au_FF_*_scanNr_0.zip<br/>(Zarr: 1440 frames)"]
SPOT_MAT["SpotMatrixGen.csv<br/>(theoretical spot positions)"]
GRAINS_GEN["GrainsGen.csv<br/>(re-indexed grain list)"]
HKLS_SIM["hkls.csv<br/>(HKL reflections)"]
end
FWD --> ZIP_RAW
FWD --> SPOT_MAT
FWD --> GRAINS_GEN
FWD --> HKLS_SIM
subgraph Step2["Step 2: Zarr Enrichment"]
ENRICH["write_analysis_parameters<br/>(inject metadata)"]
RENAME["Rename to<br/>*.analysis.MIDAS.zip"]
end
ZIP_RAW --> ENRICH
PARAMS --> ENRICH
ENRICH --> RENAME
subgraph Step3["Step 3: ff_MIDAS.py Pipeline"]
direction TB
HKLGEN["GetHKLListZarr"]
PEAKS["PeaksFittingOMPZarrRefactor<br/>→ find spots in images"]
MERGE["MergeOverlappingPeaksAllZarr<br/>→ consolidate peaks"]
CALCR["CalcRadiusAllZarr<br/>→ compute ring radii"]
FITS["FitSetupZarr<br/>→ lab coordinate transform"]
BIND["SaveBinData<br/>→ binary format"]
INDEX["IndexerOMP<br/>→ match spots to orientations"]
REFINE["FitPosOrStrainsOMP<br/>→ refine positions & strains"]
PROCG["ProcessGrainsZarr<br/>→ final grain list"]
HKLGEN --> PEAKS
PEAKS --> MERGE
MERGE --> CALCR
CALCR --> FITS
FITS --> BIND
BIND --> INDEX
INDEX --> REFINE
REFINE --> PROCG
end
RENAME -->|"*.analysis.MIDAS.zip"| HKLGEN
subgraph Step3Out["Pipeline Outputs in LayerNr_1/"]
INPUTALL["InputAll.csv<br/>(transformed spot data)"]
SPOTM["SpotMatrix.csv<br/>(matched spots)"]
RESULT["Result_*.csv<br/>(indexing results)"]
GRAINS_OUT["Grains.csv<br/>(%NumGrains 3)"]
end
PEAKS -->|"Temp/<br/>(per-frame peaks)"| MERGE
FITS --> INPUTALL
INDEX --> RESULT
PROCG --> GRAINS_OUT
REFINE -->|"Output/<br/>(refined orientations)"| PROCG
subgraph Step4["Step 4: Validation"]
CHECK["✅ Exit code 0<br/>NumGrains == 3"]
end
GRAINS_OUT --> CHECK
style Inputs fill:#e8f4f8,stroke:#2196F3
style Step1 fill:#fff3e0,stroke:#FF9800
style Step1Out fill:#fce4ec,stroke:#E91E63
style Step2 fill:#f3e5f5,stroke:#9C27B0
style Step3 fill:#e8f5e9,stroke:#4CAF50
style Step3Out fill:#fce4ec,stroke:#E91E63
style Step4 fill:#e8f5e9,stroke:#4CAF50
style CHECK fill:#c8e6c9,stroke:#2E7D32
- MIDAS must be compiled (all FF_HEDM binaries built)
- The
midas_envconda environment must be active:source /path/to/miniconda3/bin/activate midas_env
python tests/test_ff_hedm.py [-nCPUs N] [-paramFN /path/to/Parameters.txt] [--px-overlap] [--dual-dataset] [--no-cleanup] [--cleanup-only]| Argument | Default | Description |
|---|---|---|
-nCPUs |
1 |
Number of CPUs for parallel steps |
-paramFN |
FF_HEDM/Example/Parameters.txt |
Path to the parameter file |
--px-overlap |
off | Also run pixel-overlap peaksearch test using Parameters_px_overlaps.txt |
--dual-dataset |
off | Also run dual-dataset refinement test using ff_dual_datasets.py |
--no-cleanup |
off | Keep all generated files after the test |
--cleanup-only |
off | Only cleanup generated files, don't run any tests |
source ~/miniconda3/bin/activate midas_env
python ~/opt/MIDAS/tests/test_ff_hedm.py -nCPUs 4
# With pixel-overlap test:
python ~/opt/MIDAS/tests/test_ff_hedm.py -nCPUs 4 --px-overlap
# Keep files for inspection:
python ~/opt/MIDAS/tests/test_ff_hedm.py -nCPUs 4 --no-cleanup
# Just cleanup leftover files:
python ~/opt/MIDAS/tests/test_ff_hedm.py --cleanup-onlyThe benchmark always runs in FF_HEDM/Example/ relative to MIDAS_HOME. All intermediate and output files are generated there.
Runs ForwardSimulationCompressed with the example parameter file and GrainsSim.csv (3 Au grains) to produce a synthetic Zarr zip containing detector images.
Injects analysis metadata (ring thresholds, omega ranges, box sizes, etc.) into the Zarr zip so that ff_MIDAS.py can process it directly.
Launches ff_MIDAS.py with -convertFiles 0 (skipping raw data conversion since the Zarr is already prepared). The pipeline runs:
- PeakSearch → finds diffraction spots in the synthetic images
- MergeOverlappingPeaks → consolidates overlapping peaks
- CalcRadius → computes ring radii
- FitSetup → transforms data for indexing
- IndexerOMP → indexes spots to grain orientations
- FitPosOrStrainsOMP → refines grain positions and strains
- ProcessGrains → produces the final
Grains.csv
Compares the newly generated *_consolidated.h5 against the reference file consolidated_Output.h5, checking each pipeline stage (PeaksFitting, MergeOverlaps, CalcRadius, FitSetup, Grains).
When --px-overlap is specified, the test additionally:
- Patches
UsePixelOverlap 1anddoPeakFit 1into the existing Zarr zip - Re-runs
ff_MIDAS.pywith the pixel-overlap parameters - Compares the output against
consolidated_Output_px_overlaps.h5
This validates the pixel-overlap merge path end-to-end.
When --dual-dataset is specified, the test additionally:
- Runs
ff_dual_datasets.pyusing the same simulated data as both datasets (with zero offsets) - Verifies that
MapDatasetsandFitPosOrStrainsDoubleDatasetcomplete successfully - Compares the dual-dataset
Grains.csvagainst the single-dataset results
This validates the dual-dataset pipeline end-to-end, including the dataset mapping and combined refinement steps.
A successful run produces output like:
First line of Grains.csv: %NumGrains 3
*** Automated FF_HEDM Benchmark Suite Executed Successfully ***
The benchmark should recover all 3 input grains from GrainsSim.csv.
The following files are generated in FF_HEDM/Example/ and are excluded via .gitignore:
| File/Directory | Description |
|---|---|
test_Parameters.txt |
Modified parameter file with absolute paths |
Au_FF_*.analysis.MIDAS.zip |
Zarr zip with synthetic diffraction data |
GrainsGen.csv |
Re-indexed grain list from simulation |
SpotMatrixGen.csv |
Theoretical spot positions from simulation |
hkls.csv |
HKL list generated during simulation |
LayerNr_1/ |
Full pipeline output directory |
runinfo/ |
Parsl runtime information |
ForwardSimulationCompressed not found: Runcmake --build . --target ForwardSimulationCompressedin thebuild/directory.zarr.ZipStoreerror: Ensure you are using themidas_envconda environment which has the correct zarr version.- Pipeline fails at indexing: Check that the simulation produced valid detector images. The
SpotMatrixGen.csvfile can be inspected to verify spot positions.