upxo.pxtal.fm_steel_3d.intercept_advice module

Linear-intercept grain sizes along the directions blocks are sliced in.

Block and sub-block thicknesses have to fit inside the grains they slice. These functions measure the intercept grain size along the direction each grain’s blocks will be sliced in, or along each axis, so a thickness range can be checked against it. Nothing is generated or modified.

upxo.pxtal.fm_steel_3d.intercept_advice.prospective_slicing_normals(fm_pag) → Dict[int, ndarray][source]

Unit normal of the plane each grain’s blocks would be sliced along.

Reproduces how block generation picks candidate {111} planes for the packets of a PAG and cycles them over its grains, without generating any block. Grains without voxels are left out.

upxo.pxtal.fm_steel_3d.intercept_advice.intercept_sizes_by_direction(lgi: ndarray, voxel_size: float, normals: dict, line_budget: int = 300, phase_array: ndarray | None = None, valid_phase_ids: Sequence[int] | None = None) → dict[source]

Intercept grain sizes along each distinct direction of normals.

Parameters:
  • normals (dict) – {id: unit normal}; ids with the same direction share one measurement.

  • line_budget (int) – Intercept lines in total, split over the distinct directions (at least 20 per direction), so the cost does not grow with the number of directions.

  • phase_array – Passed on to directional_intercept_grain_size.

  • valid_phase_ids – Passed on to directional_intercept_grain_size.

Returns:

combined (all intercept lengths, pooled), direction_means (mean length of each direction that had any), total_lines and n_directions.

Return type:

dict

upxo.pxtal.fm_steel_3d.intercept_advice.thickness_range_from_intercepts(stats_by_axis: dict) → Tuple[float, float] | None[source]

Interquartile range (25th and 75th percentile) of the intercept lengths pooled over the x, y and z axes; None when there are none.

stats_by_axis maps ‘x’, ‘y’ and ‘z’ to dicts with raw_segments.