optiland.analysis.intensity

Radiant Intensity Analysis

This module implements the logic for radiant intensity analysis in an optical system, representing power per unit solid angle.

Manuel Fragata Mendes, June 2025

Classes

RadiantIntensity(optic[, ...])

Computes and visualizes the radiant intensity distribution.

class RadiantIntensity(optic: Optic, num_angular_bins_X: int = 101, num_angular_bins_Y: int = 101, angle_X_min: float = -15.0, angle_X_max: float = 15.0, angle_Y_min: float = -15.0, angle_Y_max: float = 15.0, use_absolute_units: bool = True, reference_surface_index: int = -1, fields='all', wavelengths='all', num_rays: int = 100000, distribution: DistributionType = 'random', user_initial_rays=None, source=None, skip_trace: bool = False)[source]

Computes and visualizes the radiant intensity distribution.

By default, this analysis calculates radiant intensity in absolute physical units of Watts/steradian (W/sr). This requires that the .intensity attribute of the rays traced represents the physical power of each ray.

The angles correspond to projections, similar to Zemax’s “Angle Space” plots (Angle X, Angle Y).

optic

The optical system.

Type:

optiland.optic.Optic

num_angular_bins_X

Number of bins for the X-angle.

Type:

int

num_angular_bins_Y

Number of bins for the Y-angle.

Type:

int

angle_X_min

Minimum X-angle in degrees for binning.

Type:

float

angle_X_max

Maximum X-angle in degrees for binning.

Type:

float

angle_Y_min

Minimum Y-angle in degrees for binning.

Type:

float

angle_Y_max

Maximum Y-angle in degrees for binning.

Type:

float

reference_surface_index

Index of the surface after which ray directions are considered.

Type:

int

fields

List of field coordinates for analysis.

Type:

list

wavelengths

List of wavelengths for analysis.

Type:

list

num_rays

Number of rays to trace if user_initial_rays is None.

Type:

int

distribution_name

Ray distribution if user_initial_rays is None.

Type:

str

user_initial_rays

Optional user-provided initial rays.

Type:

RealRays | None

source

Optional extended source object (e.g., GaussianSource) to generate initial rays automatically. Cannot be used with user_initial_rays. When provided, num_rays determines how many rays to generate.

Type:

BaseSource | None

data
Stores (intensity_map,

angle_X_bin_edges, angle_Y_bin_edges, angle_X_bin_centers, angle_Y_bin_centers)

for each (field, wavelength).

Type:

list[list[tuple]]

use_absolute_units

If True (default), calculates intensity in W/sr. If False, result is a relative value normalized to the peak.

Type:

bool

peak_intensity_values()[source]
view(fig_to_plot_on=None, figsize=(8, 6), cmap='jet', cross_section=None, cross_section_style='-', cross_section_color='red', *, normalize=None, show: bool = True)[source]

Display radiant intensity maps and/or cross-sections.

Parameters:
  • fig_to_plot_on (matplotlib.figure.Figure, optional) – Existing figure to plot on. If None, a new figure is created.

  • figsize (tuple, optional) – Size of the figure (width, height) in inches for each subplot.

  • cmap (str or matplotlib.colors.Colormap, optional) – Colormap to use for the intensity maps.

  • cross_section (tuple[str, int], optional) – If provided, plot only cross-sections. Should be a tuple of (‘cross-x’ or ‘cross-y’, index), where index is the slice index along the specified axis. Default is None (plots 2D map + cross section).

  • cross_section_style (str, optional) – Line style for cross-section plots.

  • cross_section_color (str, optional) – Color for cross-section plots.

  • normalize (bool, optional) – If True, normalize intensity to peak value. If False, use absolute values (W/sr). If None (default), use the value set in class initialization.

Returns:

  • fig (matplotlib.figure.Figure) – The figure object containing the plots.

  • axs (numpy.ndarray) – Array of Axes objects for the subplots, or single Axes if only one subplot.