upxo.pxtal.fm_steel_3d.junction_viz_3d module

junction_viz_3d.py

PyVista visualization of junction lines (triple-line edges) and junction points (vertices where >=3 domains meet) for FM steel 3-D microstructures at any hierarchy level.

Triple-line edges and junction points are rendered as 3D cylinders and spheres respectively, with full per-level customization of colours, sizes, and visibility.

Public API

view_junction_lines(fm, levels_config, …)

Highly customizable junction visualization with per-level control.

Example

from upxo.pxtal.fm_steel_3d.junction_viz_3d import view_junction_lines

view_junction_lines(

fm_sb, levels_config={

‘pag’: {

‘show’: True, ‘line_color’: ‘#9B59B6’, ‘line_radius’: 0.3, ‘show_jps’: True, ‘jp_color’: ‘#9B59B6’, ‘jp_radius’: 0.5,

}, ‘block’: {

‘show’: True, ‘line_color’: ‘#27AE60’, ‘line_radius’: 0.2, ‘show_jps’: False,

},

}, background_color=’white’, grain_background_cmap=’viridis’,

)

upxo.pxtal.fm_steel_3d.junction_viz_3d.view_junction_lines(fm, levels_config: Dict[str, Dict[str, Any]] | None = None, show_grain_background: bool = True, grain_background_cmap: str = 'Greys', grain_background_opacity: float = 0.15, background_color: str = 'white', window_size: Tuple[int, int] = (1100, 900), title: str | None = None) → None[source]

Display junction lines and points for all FM steel hierarchy levels with full per-level customization.

Triple-line edges are rendered as 3-D cylinders; junction points as spheres (optional per level). All parameters are customizable per level via the levels_config dictionary.

Parameters:
  • fm (FMSteel3D* state object) – Any state along the pipeline (FMSteel3DBase through FMSteel3DWithSubBlocks). Must expose .lgi, .voxel_size, and the attributes for requested levels.

  • levels_config (dict or None) –

    Per-level configuration. Keys are level names (‘grain’, ‘pag’, ‘packet’, ‘block’, ‘subblock’). Values are dicts with keys:

    ’show’ (bool) — whether to display this level ‘line_color’ (str) — hex colour for junction lines ‘line_radius’ (float) — tube radius for junction lines (in voxel_size units) ‘show_jps’ (bool) — whether to show junction points ‘jp_color’ (str) — hex colour for junction point spheres ‘jp_radius’ (float) — sphere radius for junction points

    If None or missing levels, uses default configuration from _DEFAULT_LEVELS_CONFIG.

  • show_grain_background (bool) – If True, show the grain structure as a semi-transparent voxel mesh.

  • grain_background_cmap (str) – Matplotlib colormap name for the grain background (e.g. ‘Greys’, ‘viridis’).

  • grain_background_opacity (float) – Opacity of the grain background (0 invisible, 1 opaque).

  • background_color (str) – Plotter background colour (‘white’, ‘black’, etc.).

  • window_size ((int, int)) – PyVista plotter window size in pixels.

  • title (str or None) – Window title; auto-generated if None.

Notes

  • For large grids (>150³) the total segment/point count can exceed 10⁶. Rendering is efficient but may be slow on low-end GPUs.

  • Junction points (spheres) have noticeably higher GPU cost than lines (cylinders); disable them where not needed.

  • Grain background is semi-transparent so junction geometry remains visible.