upxo.pxtal.fm_steel_3d.subblock_generator_3d module

SubBlockGenerator3D: Worker class for slicing martensitic blocks into sub-blocks/laths.

Uses the same signed-distance slab projection as BlockGenerator3D, but the slicing normal is inherited from the parent block (via block_slicing_normals) rather than recomputed from crystallography.

Classes:

SubBlockGenerator3D: Sub-block generation worker.

class upxo.pxtal.fm_steel_3d.subblock_generator_3d.SubBlockGenerator3D(verbosity: int = 0)[source]

Bases: object

Worker class for slicing martensitic blocks into sub-blocks (laths).

Sub-blocks within a block share the same slicing direction as their parent block and carry a small orientation spread around the parent block orientation.

Thin blocks whose projected thickness along the slicing normal is less than the minimum requested sub-block thickness are handled via thin_block_strategy:

‘skip’ — treat the entire block as a single sub-block (no subdivision). ‘upscale’ — caller must rescale the grid before calling; treated as ‘skip’

here if the block is still too thin after rescaling.

All voxels in every block are exhausted: the final slab of each block absorbs any remainder so no voxels are left unassigned.

generate_subblocks_for_all_blocks(all_blocks: Dict[str, ndarray], block_slicing_normals: Dict[str, ndarray], subblock_thickness_range: Tuple[float, float] = (1.0, 2.0), thin_block_strategy: str = 'skip', random_seed: int | None = None, slab_connectivity: int = 26) → Tuple[Dict[str, ndarray], Dict[str, List[str]], Dict[str, ndarray]][source]

Generate sub-blocks for every block in all_blocks.

Parameters:
  • all_blocks (dict) – {block_id: (n_voxels, 3) integer voxel coordinate array}.

  • block_slicing_normals (dict) – {block_id: unit_normal (3,)} — inherited from FMSteel3DWithBlocks.

  • subblock_thickness_range (tuple of (float, float)) – (min, max) sub-block thickness in voxels. Each block draws its own thickness uniformly from this range.

  • thin_block_strategy (str) –

    Policy for blocks whose projected thickness < min thickness: ‘skip’ — the whole block becomes one sub-block. ‘upscale’ — same as ‘skip’ at this stage; the caller should have

    already rescaled the grid before calling.

  • random_seed (int, optional) – Seed for reproducibility.

Returns:

  • all_subblocks (dict) – {subblock_id: (n_voxels, 3) array}.

  • block_to_subblocks_map (dict) – {block_id: [subblock_id, …]}.

  • subblock_slicing_normals (dict) – {subblock_id: unit_normal (3,)} — same normal as parent block, available for any further subdivision level.