upxo.pxtal.twinned_simple_3d.stride_study module
stride_study.py
EBSD step-size (stride) sensitivity study for the twinned simple 3D pipeline: how grain-morphology statistics respond to subsampling the raw EBSD map at increasing strides, all other detection/crop/clean settings held fixed.
Ported from pxtal/twinned_simple_3d/gui/pages_ebsd.py (previously
only reachable through the GUI’s EBSDInputPage.on_run_stride_study
– the module-level _run_stride_study/_area_fraction_below
functions themselves had no GUI dependency and are unchanged here).
- upxo.pxtal.twinned_simple_3d.stride_study.run_stride_study(ctf_path, strides, min_grain_size_detect, misori_tol, crop_region, min_grain_size_clean, connectivity, reuse_subsampled=True, verbose=False)[source]
Runs Import -> Detect -> Crop -> Clean once per stride value, holding every other setting fixed – isolates how step size alone affects computed grain morphology.
- Parameters:
ctf_path (str)
strides (iterable of int) – Deduplicated internally; 1 means load the original file directly (no subsampling), matching the “no subsampling” baseline case.
min_grain_size_detect (grain-detection settings.)
misori_tol (grain-detection settings.)
crop_region ((xstart_pct, ystart_pct, xend_pct, yend_pct) or None) – Crop settings; None skips cropping entirely.
min_grain_size_clean (cleaning settings.)
connectivity (cleaning settings.)
reuse_subsampled (bool) – Reuse an existing on-disk subsampled .ctf for a given stride instead of regenerating it.
verbose (bool) – Forwarded to
clean_and_rechar_from_rdr.
- Returns:
- {‘stride’: int, ‘step_size’: float, ‘n_grains’: int,
’shape’: (ny, nx), ‘prop_ebsd’: dict, ‘stat_ebsd’: dict}
- Return type:
- upxo.pxtal.twinned_simple_3d.stride_study.area_fraction_below(prop_ebsd, prop_key, threshold)[source]
Fraction of TOTAL grain area occupied by grains whose
prop_keyvalue is belowthreshold– the “volume fraction” (area fraction, for a 2D EBSD map) of grains below a given property threshold (e.g. the property’s own 25th percentile or mean), area-weighted rather than a plain grain-count fraction.