upxo.pxtal.twinned_simple_3d.steps.steps_base_grain_structure_mc module

Base Grain Structure – Part E of the Twinned FCC walkthrough.

Method selection is trivial on this path (Monte-Carlo is the base grain structure method this walkthrough covers – Voronoi/Image-Import are different, unworked paths). Runs the 3D MC grain-growth simulation, computes the labelled feature index (LFI) for every saved temporal slice, then cleans it.

upxo.pxtal.twinned_simple_3d.steps.steps_base_grain_structure_mc.run_mc_simulation(xmax=50.0, ymax=50.0, zmax=50.0, xinc=1.0, yinc=1.0, zinc=1.0, q_states=10, mcsteps=100, save_interval=5, mcalg='300b', consider_boltzmann=True, boltzmann_temp_factor=0.01, rng_seed=0, verbose=True)[source]

Step 1 – runs a 3D Potts-model Monte-Carlo grain growth simulation. Domain runs from 0 to the given max in each direction.

Returns:

  • mcgsV1_1 (the simulated object – pxt.m holds the list of saved)

  • temporal-slice step indices, pxt.gs[t] the grain structure at step t.

upxo.pxtal.twinned_simple_3d.steps.steps_base_grain_structure_mc.calculate_lfi(pxt, verbose=True)[source]

Step 2 – computes the labelled feature index (grain labels) for every saved temporal slice at once; cleaning (below) then operates on this persisted LFI.

Returns:

dict

Return type:

{tslice_key: {‘n_grains’: int, …}}

upxo.pxtal.twinned_simple_3d.steps.steps_base_grain_structure_mc.clean_structure(pxt, min_grain_size=4, start_index=1, n_passes=5, do_merge_small=True, do_spike_removal=True, verbose=True)[source]

Step 3 – merges too-small grains and removes single-voxel spikes, recursively, for every saved slice from start_index on (slices before it are left uncleaned/unavailable to ranking). n_passes is capped at 20 internally as a safety limit.

Return type:

(cumulative_summary, n_passes_run)