upxo.pxtal.fm_steel_3d.disorientation_stats module
Disorientation statistics across the FM steel hierarchy.
Two kinds of statistics are provided.
- 3-D pair sampling (
hierarchical_disorientations) Disorientation angles of PAG pairs (adjacent or random), block pairs (within one PAG or across PAGs) and sub-block pairs (within one block or across blocks).
- 2-D slice histograms (
slice_disorientation_histograms) Density histograms of the disorientation across the boundaries seen on evenly spaced slices normal to x, y and z.
Angles are in degrees and are cubic disorientations (minimum angle over the
24 x 24 cubic symmetry pairs, not a plain rotation angle). Disorientations of
orientation triples come from OrientationAssigner3D.disorientation_deg;
the slice histograms use the vectorised equivalent,
orientation_assigner_3d.disorientation_from_g_batch, for speed.
- upxo.pxtal.fm_steel_3d.disorientation_stats.parent_block_id(subblock_id: str) str[source]
Id of the block a sub-block belongs to:
'SB_<block id>_<n>'-> block id.
- upxo.pxtal.fm_steel_3d.disorientation_stats.adjacent_pag_disorientations(pag_orientations: dict, neighbours: dict, assigner: OrientationAssigner3D | None = None) List[float][source]
Disorientation of every pair of neighbouring PAGs, each pair once.
neighboursmaps a PAG id to the ids of its neighbours. Pairs where a PAG has no orientation are skipped.
- upxo.pxtal.fm_steel_3d.disorientation_stats.random_pag_disorientations(pag_orientations: dict, n_pairs: int, rng, assigner: OrientationAssigner3D | None = None) List[float][source]
Disorientation of
n_pairsrandom pairs of distinct PAGs.Empty if there are fewer than two PAGs.
- upxo.pxtal.fm_steel_3d.disorientation_stats.subblock_disorientations(subblock_orientations: dict, block_to_subblocks: dict, n_pairs: int, rng, within: bool = True, across: bool = True, assigner: OrientationAssigner3D | None = None) dict[source]
Sub-block pair disorientations,
{'within': [...], 'across': [...]}.within: two sub-blocks of the same block (blocks with fewer than two sub-blocks are not used). across: two sub-blocks of different blocks; at most
n_pairspairs, from up to4 * n_pairsdraws. The within pairs are drawn first, so the two lists share one random stream.
- upxo.pxtal.fm_steel_3d.disorientation_stats.hierarchical_disorientations(fm_orientations, selected: Iterable[str], n_pairs: int, seed: int, fm_subblocks=None, assigner: OrientationAssigner3D | None = None) dict[source]
Sampled disorientation angles of the selected pair types.
- Parameters:
fm_orientations – State with block and PAG orientations (
pag_orientationsandcompute_misorientation_distribution); its parents give the PAG neighbours.selected (iterable of str) – Types from
SAMPLED_TYPES.n_pairs (int) – Pairs sampled per type.
seed (int) –
compute_misorientation_distributionusesseed; the PAG and sub-block pairs are drawn fromdefault_rng(seed + 100).fm_subblocks – State with
subblock_orientationsandblock_to_subblocks_map; the sub-block types are skipped when it is None.
- Returns:
One list of angles per selected type that could be computed.
- Return type:
- upxo.pxtal.fm_steel_3d.disorientation_stats.slice_disorientation_histograms(pag_id_map: ndarray, fm_blocks, selected: Iterable[str], n_slices: Sequence[int], fm_subblocks=None, bins: ndarray | None = None, assigner: OrientationAssigner3D | None = None) dict[source]
Disorientation histograms on slices, one list of histograms per axis.
- Parameters:
pag_id_map (ndarray) – PAG id of every voxel (0 or less for void).
fm_blocks – State with
all_blocks(block id -> voxel coordinates),block_orientationsandpag_orientations.selected (iterable of str) – Types from
SLICE_TYPES:blk_within/blk_across(block pairs in the same / different PAGs),pag_adj(PAG pairs) andsb_within/sb_across(sub-block pairs in the same / different blocks).n_slices ((int, int, int)) – Number of slices normal to x, y and z.
fm_subblocks – State with
all_subblocksandsubblock_orientations; the sub-block types are skipped when it is None.bins (ndarray, optional) – Histogram bin edges (degrees);
DEFAULT_ANGLE_BINSby default.
- Returns:
{type: {'x': [hist, ...], 'y': [...], 'z': [...]}}; each histogram is the density overbinsfor one slice.- Return type: