sources.visualization
Sources Visualization Module
This module provides visualization tools for extended sources, allowing users to validate and visualize their source definitions before running full optical system traces.
The SourceViewer class creates a 3-panel plot showing: 1. XY spatial distribution with intensity color-coding 2. XZ ray propagation paths 3. YZ ray propagation paths
This helps users verify the spatial and angular properties of their sources.
Classes
|
A class used to visualize extended sources. |
- class SourceViewer(source: BaseSource)[source]
A class used to visualize extended sources.
This viewer creates a comprehensive 3-panel visualization of an extended source showing the spatial distribution and propagation characteristics of the generated rays.
- Parameters:
source (BaseSource) – The extended source to be visualized.
- source
The extended source being visualized.
- Type:
- view(num_rays: int = 5000, propagation_distance: float = 0.1, figsize: tuple[float, float] = (20, 8), cross_spatial: tuple[str, str] = ('x', 'y'), cross_angular: tuple[str, str] = ('L', 'M')) tuple[Figure, list[Axes]][source]
Create a comprehensive visualization of the extended source.
This method generates a multi-panel plot showing: 1. Column 1: XY spatial distribution and angular distribution 2. Column 2: Cross-sections (spatial and angular) 3. Column 3: XZ and YZ ray propagation paths
- Parameters:
num_rays (int, optional) – Number of rays to generate for visualization. Defaults to 5000.
propagation_distance (float, optional) – Distance in mm to propagate rays for path visualization. Defaults to 0.1.
figsize (tuple[float, float], optional) – Figure size (width, height) in inches. Defaults to (18, 8).
cross_spatial (tuple[str, str], optional) – Spatial cross-section axes. Defaults to (“x”, “y”).
cross_angular (tuple[str, str], optional) – Angular cross-section axes. Defaults to (“L”, “M”).
- Returns:
Matplotlib figure and list of 6 axes objects.
- Return type:
tuple[Figure, list[Axes]]