upxo.pxtal.twinned_simple_3d.selfrepr_morphology module
selfrepr_morphology.py
Per-grain morphological parameter computation for EBSD self- representativeness studies (twinned_simple_3d’s Self Repr.-1 page): area, perimeter, circle-equivalent diameter, aspect ratio, minor/major axis length, circularity, coordination number, grain-boundary segment length, and triple-junction-point count, computed identically for a parent EBSD domain and any cropped sub-domain.
- upxo.pxtal.twinned_simple_3d.selfrepr_morphology.compute_morphological_parameters(lgi, prop_ebsd=None, voxel_size=1.0)[source]
Compute the full morphological-parameter bundle for one 2D grain- label field – the parent EBSD domain or a cropped subset.
- Parameters:
prop_ebsd (dict or None) – The EBSD reader’s own per-grain property dict (
rg.prop_ebsd), if already available (the PARENT domain always has one) – reused directly for minor_axis_length/major_axis_length so the parent side isn’t recomputed. When None (a cropped subset, which has no prop_ebsd of its own), these two are computed fresh via the same underlying regionprops path (ebsd_reader._char_lfi) so parent and subset values come from identical logic.voxel_size (float) – Physical pixel size (microns), for area/perimeter/length scaling.
- Returns:
One entry per key in MORPH_PARAM_KEYS, each a {grain_id: value} dict covering every grain actually present in lgi.
’gb_segment_length’ – total boundary length between this grain’s own triple-junction points; a grain with zero triple junctions on its boundary (e.g. a true island grain, fully surrounded by one neighbour) falls back to its full perimeter, since its entire boundary is then a single “segment”.
- Return type:
- upxo.pxtal.twinned_simple_3d.selfrepr_morphology.boundary_grain_ratio_parent(rg)[source]
Block [2] “Basics” glue: Ng(boundary)/Ng(total) for the parent EBSD domain currently loaded on the pipeline.
- Parameters:
rg (repgen2d) – Must have
.lfi_ebsdpopulated (post Clean & Characterise).- Returns:
dict
- Return type:
{‘n_boundary’, ‘n_internal’, ‘n_total’, ‘ratio’}