optiland.analysis.angle_vs_height
Incident Angle vs. Height Plot Analysis
This module provides classes for analyzing the incident angle versus image height for optical systems, across both pupil and field.
Original concept by BuergiR, 2025 Implemented in Optiland by Kramer Harrison, 2025
Classes
|
Abstract base class for Angle vs. |
|
Represents an analysis of incident angle vs. |
|
Represents an analysis of incident angle vs. |
- class BaseAngleVsHeightAnalysis(optic, surface_idx: int = -1, axis: int = 1, wavelength: str | float = 'primary', num_points: int = 128)[source]
Abstract base class for Angle vs. Height analysis routines.
This class provides the common framework for generating angle vs. height data using the optic’s trace_generic method, and abstract methods for defining how the tracing coordinates vary.
- Parameters:
optic (Optic) – The optic object to analyze.
surface_idx (int, optional) – Index of the surface at which the angle and height are measured. Defaults to -1 (last surface).
axis (int, optional) – Specifies the axis for measurement. 0 for x-axis, 1 for y-axis. Defaults to 1 (y-axis).
wavelength (str or float, optional) – A single wavelength in microns. Defaults to ‘primary’.
num_points (int, optional) – The number of points used for the plot. Defaults to 128.
- surface_idx
Index of the surface for measurements.
- Type:
int
- axis
Axis for measurement (0 for x, 1 for y).
- Type:
int
- wavelengths
The wavelengths being analyzed (handled by BaseAnalysis).
- Type:
list
- num_points
The number of points generated for the analysis.
- Type:
int
- data
The generated data for the analysis. Structure depends on subclass.
- Type:
dict
- view(fig_to_plot_on: Figure = None, figsize: tuple[float, float] = (8, 5.5), title: str = None, cmap: str | Colormap = 'viridis', line_style: str = '-', *, show: bool = True) tuple[plt.Figure, Axes][source]
Displays a plot of the incident angle vs. image height analysis.
- Parameters:
fig_to_plot_on (matplotlib.figure.Figure, optional) – A figure object to plot on. If None, a new figure is created. Defaults to None.
figsize (tuple, optional) – The size of the figure. Defaults to (8, 5.5).
title (str, optional) – An optional subtitle to be added to the plot. If None, lens name is used.
cmap (str, optional) – The colormap for the plot line. Defaults to ‘viridis’.
line_style (str, optional) – Matplotlib plot style. Defaults to ‘-‘.
show (bool) – If True (default), calls plt.show(). Set False for headless use.
- Returns:
A tuple containing the figure and axes objects used for plotting.
- Return type:
tuple
- class FieldIncidentAngleVsHeight(optic, surface_idx: int = -1, axis: int = 1, wavelength: str | float = 'primary', pupil: tuple = (0, 0), num_points: int = 128)[source]
Represents an analysis of incident angle vs. image height by varying through all image field coordinates (Hx, Hy) for a given pupil field point.
This analysis is useful for testing the telecentricity of a scan lens with a scan mirror at the entrance pupil. Note: Uses trace_generic(), which is slower than trace().
- Parameters:
optic (Optic) – The optic object to analyze.
surface_idx (int, optional) – Index of the surface at which the angle and height are measured. Defaults to -1 (last surface).
axis (int, optional) – Specifies the axis for measurement. 0 for x-axis, 1 for y-axis. Defaults to 1 (y-axis).
wavelength (str or float, optional) – A single wavelength in microns. Defaults to ‘primary’.
pupil (tuple, optional) – A single pupil field point (Px, Py). Defaults to (0, 0).
num_points (int, optional) – The number of points displayed on the plot. Defaults to 128.
- surface_idx
Index of the surface for measurements.
- Type:
int
- axis
Axis for measurement (0 for x, 1 for y).
- Type:
int
- pupil
The pupil field point (fixed for tracing).
- Type:
tuple
- num_points
The number of points generated for the analysis.
- Type:
int
- data
The generated data for the analysis, structured as: {
(Px_fixed, Py_fixed, wavelength_value): {‘height’: np.ndarray, ‘angle’: np.ndarray}
}
- Type:
dict
- view(fig_to_plot_on: Figure = None, figsize: tuple[float, float] = (8, 5.5), title: str = None, cmap: str | Colormap = 'viridis', line_style: str = '-', *, show: bool = True) tuple[plt.Figure, Axes]
Displays a plot of the incident angle vs. image height analysis.
- Parameters:
fig_to_plot_on (matplotlib.figure.Figure, optional) – A figure object to plot on. If None, a new figure is created. Defaults to None.
figsize (tuple, optional) – The size of the figure. Defaults to (8, 5.5).
title (str, optional) – An optional subtitle to be added to the plot. If None, lens name is used.
cmap (str, optional) – The colormap for the plot line. Defaults to ‘viridis’.
line_style (str, optional) – Matplotlib plot style. Defaults to ‘-‘.
show (bool) – If True (default), calls plt.show(). Set False for headless use.
- Returns:
A tuple containing the figure and axes objects used for plotting.
- Return type:
tuple
- class PupilIncidentAngleVsHeight(optic, surface_idx: int = -1, axis: int = 1, wavelength: str | float = 'primary', field: tuple = (0, 0), num_points: int = 128)[source]
Represents an analysis of incident angle vs. image height by varying through all pupil coordinates (Px, Py) for a given image field point.
This analysis is useful for testing the telecentricity of a lens after a point light source (object).
- Parameters:
optic (Optic) – The optic object to analyze.
surface_idx (int, optional) – Index of the surface at which the angle and height are measured. Defaults to -1 (last surface).
axis (int, optional) – Specifies the axis for measurement. 0 for x-axis, 1 for y-axis. Defaults to 1 (y-axis).
wavelength (str or float, optional) – A single wavelength in microns. Defaults to ‘primary’.
field (tuple, optional) – A single relative image field point (Hx, Hy). Defaults to (0, 0).
num_points (int, optional) – The number of points used for the plot. Defaults to 128.
- surface_idx
Index of the surface for measurements.
- Type:
int
- axis
Axis for measurement (0 for x, 1 for y).
- Type:
int
- field
The relative image field point (fixed for tracing).
- Type:
tuple
- num_points
The number of points generated for the analysis.
- Type:
int
- data
The generated data for the analysis, structured as: {(Hx_fixed, Hy_fixed, wavelength_value): {‘height’: np.ndarray, ‘angle’: np.ndarray}}
- Type:
dict
- view(fig_to_plot_on: Figure = None, figsize: tuple[float, float] = (8, 5.5), title: str = None, cmap: str | Colormap = 'viridis', line_style: str = '-', *, show: bool = True) tuple[plt.Figure, Axes]
Displays a plot of the incident angle vs. image height analysis.
- Parameters:
fig_to_plot_on (matplotlib.figure.Figure, optional) – A figure object to plot on. If None, a new figure is created. Defaults to None.
figsize (tuple, optional) – The size of the figure. Defaults to (8, 5.5).
title (str, optional) – An optional subtitle to be added to the plot. If None, lens name is used.
cmap (str, optional) – The colormap for the plot line. Defaults to ‘viridis’.
line_style (str, optional) – Matplotlib plot style. Defaults to ‘-‘.
show (bool) – If True (default), calls plt.show(). Set False for headless use.
- Returns:
A tuple containing the figure and axes objects used for plotting.
- Return type:
tuple