upxo.pxtal.twinned_simple_3d.steps.steps_self_repr_1 module

Self Repr.-1 – Part C of the Twinned FCC walkthrough (OPTIONAL).

“Ng(boundary)/Ng(total)” for the parent domain, moving-rectangle sub-domain extraction, morphological-parameter distributions for parent vs. subsets, and representativeness scoring between them.

Disabled by default – this is a deeper, optional representativeness study, not required for the main pipeline to proceed. Kept short here; see selfrepr_morphology.py / representativeness_metrics.py directly for the full feature set (per-(metric,parameter) qualification thresholds, publication-style plots, etc.) if you want more than this notebook’s teaching-level pass.

upxo.pxtal.twinned_simple_3d.steps.steps_self_repr_1.boundary_grain_ratio(rg)[source]

Ng(boundary)/Ng(total) for the parent EBSD domain.

Returns:

dict

Return type:

{‘n_boundary’, ‘n_internal’, ‘n_total’, ‘ratio’}

upxo.pxtal.twinned_simple_3d.steps.steps_self_repr_1.extract_subsets(rg, start_pct=0.0, length_pct=20.0, stride_pct=20.0)[source]

Moving-rectangle sub-domain extraction – a tile of `length_pct`% of the domain, stepped every `stride_pct`%, starting at `start_pct`%, independently along X and Y. Returns a list of dicts, each with ‘index’ (i, j), ‘lgi’ (the cropped label field), and ‘centroid_um’.

upxo.pxtal.twinned_simple_3d.steps.steps_self_repr_1.compute_morphology(rg, subsets, params=('area', 'perimeter'))[source]

Morphological parameters for the parent domain and every subset (same set of parameters, same units, for a fair comparison).

Returns:

dict

Return type:

{‘parent’: {param: {gid: value}}, ‘subsets’: {(i, j): {param: {gid: value}}}}

upxo.pxtal.twinned_simple_3d.steps.steps_self_repr_1.assess_representativeness(morph_results, metrics=('ks_sim', 'wasserstein_sim'))[source]

For every subset and every parameter, scores how representative that subset’s distribution is of the parent’s, using the requested metrics (all “higher = more representative”, bounded to [0, 1]).

Returns:

dict

Return type:

{(subset_index, param): {metric: score}}