upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2 module

EBSD Analysis-2 – Part D of the Twinned FCC walkthrough.

In order: MDF & Twin-Peak Selection, CSL Segregation & TVF, Grain-Role Properties, EBSD VF Partition, Twin Thickness Statistics – one function per stage, each calling the underlying repgen2d/core methods directly. This is the densest stage: its outputs (parent_info, tvf, VF-partition targets, twin thickness) feed almost everything downstream.

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.compute_mdf_and_peaks(rg, n_bins=65, angle_max=65.0, prominence=0.002, distance=3, csl_tol=2.0, bw_method='scott', n_kde=500, csl_include=None)[source]

MDF & Twin-Peak Selection – computes the misorientation-distribution function and auto-detects candidate CSL peaks. csl_include defaults to every cubic CSL type in CUBIC_CSL_ANGLES (Sigma3/5/7/9/11/13b) – pass a subset of its keys to narrow it.

Return type:

(mdf, peaks)

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.select_all_peaks(peaks)[source]

Confirms every detected peak – the default is to keep every one unless you deliberately want to narrow the set.

Returns:

  • dict ({‘indices’: […], ‘angles’: […]} – the shape)

  • segregate_csl_pairs() expects.

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.segregate_csl_pairs(rg, mdf, peaks, selected_peaks)[source]

CSL Segregation & TVF – pairs grains across each selected CSL-angle peak into parent/twin candidate pairs.

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.identify_parent_grains(rg, csl_grains)[source]

Classifies every grain touching a CSL pair as pure_parent / pure_twin / intermediate, then builds the twin-merged EBSD grain map (twins relabelled into their parent) that the Host Allocation target hosting fraction and Pre-Twin Validation grain-size reference both need – there is no other way to get it, so this always runs both calls together.

Returns:

dict

Return type:

parent_info, keyed by CSL label.

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.compute_twin_area_fractions(rg, parent_info, csl_labels=('S3  (twin)',))[source]

Twin area fraction (2D proxy for 3D TVF) per selected CSL label.

Returns:

dict

Return type:

{csl_label: tvf_dict}

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.compute_grain_role_properties(rg, parent_info, selected_props=('area',), selected_groups=('pure_parents', 'pure_twins', 'intermediates', 'non_role'))[source]

Grain-Role Properties – per-role-group property distributions (pure_parents/pure_twins/intermediates/non_role); 22 possible properties across 4 tiers are available, only ‘area’ selected by default.

Returns:

dict

Return type:

{prop_name: {group_name: ndarray}}

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.compute_vf_partition(rg, parent_info, tvf_by_label, csl_label='S3  (twin)', scale_2d_to_3d=1.0)[source]

EBSD VF Partition – splits pure twins into Type 2a (outward, touches a pure-parent) / Type 2b (inward, fully enclosed by intermediates), then derives the 3D VF targets Twin Generation uses (Stage-1, Secondary-2a, Secondary-2b).

scale_2d_to_3d=1.00 is the physically correct default for randomly oriented {111} twin lamellae (Cavalieri principle: 2D area fraction approx-equals 3D volume fraction).

Returns:

  • (vf_partition, vf_targets) (vf_targets has keys ‘tvf_stage1’,)

  • ’tvf_secondary_2a’, ‘tvf_secondary_2b’, ‘prob_secondary_outward’.

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.compute_twin_thickness(rg, parent_info, abrupt_threshold=0.8, linear_intercept_axes=('x', 'y', 'z'), linear_intercept_n_lines=20)[source]

Twin Thickness Statistics – per-grain major-axis-intercept thickness (the primary measurement) plus the classical ASTM E112-style linear-intercept method, pooled across axes. Feeds the thickness scale factor Twin Generation uses.

Note: this measurement is sensitive to EBSD step size – a coarser step size measurably inflates apparent thickness. Keep the same subsampling stride used earlier in the notebook when interpreting this result.

Returns:

  • dict (same shape as compute_mc_twin_thickness()’s result (mean,)

  • median, thick_um, n_twins, …).

upxo.pxtal.twinned_simple_3d.steps.steps_ebsd_analysis_2.ebsd_pole_figure_stages(rg, parent_info, csl_label=None)[source]

Per-grain mean orientations for the five EBSD pole-figure populations: ‘full’ (every grain), ‘parents’ (twins merged back into their host), ‘primary_twins’, ‘secondary_twins’ (undifferentiated generation 2+), and ‘all_twins’ (primary+secondary combined). Each is a {‘gids’, ‘quats’} pair ready for steps_visualization_export.plot_pole_figure()/plot_pole_figure_overlay().

csl_label=None uses parent_info’s first CSL label – irrelevant to ‘full’/’parents’ (not CSL-specific), only affects which pairing the twin-only stages are drawn from.

Returns:

  • dict ({‘csl_label’, ‘full’, ‘parents’, ‘primary_twins’,)

  • ’secondary_twins’, ‘all_twins’}