upxo.pxtal.fm_steel_3d.grain_structure_summary module

Summary numbers of a labelled grain structure.

voxel_spacing gives the voxel size along each axis for a domain of given physical dimensions and reports how far the voxels are from being cubic. grain_structure_summary gives grain-size statistics and the means of equivalent-sphere diameter, sphericity and neighbour count.

upxo.pxtal.fm_steel_3d.grain_structure_summary.voxel_spacing(physical_dimensions: Sequence[float], shape: Sequence[int]) → Tuple[float, float, float, float][source]

Voxel size along x, y and z, and the relative deviation from cubic voxels.

Parameters:
  • physical_dimensions ((lx, ly, lz))

  • shape ((nx, ny, nz))

Returns:

deviation is the largest of abs(vx - vy) / vx, abs(vx - vz) / vx and abs(vy - vz) / vy, and 0 when vx is not positive. An axis with no voxels has the spacing 1.

Return type:

(vx, vy, vz, deviation)

upxo.pxtal.fm_steel_3d.grain_structure_summary.grain_structure_summary(lfi: ndarray, voxel_size: float, metrics: dict | None = None) → Dict[str, float][source]

Grain-size statistics and mean morphology values of a label grid.

Parameters:
  • lfi (ndarray) – Grain label grid; 0 is void.

  • voxel_size (float)

  • metrics (dict, optional) – geom_metrics_3d.all_metrics(lfi) computed earlier.

Returns:

n_grains; mean_vox, min_vox, max_vox, std_vox (voxels per grain); mean_volume, min_volume, max_volume, std_volume (the same in physical units); mean_eqdia, mean_sphericity, mean_nnb (means over grains). All are 0 for a grid without grains.

Return type:

dict