optiland.wavefront.opd_fan
This module defines the OPDFan class.
Kramer Harrison, 2024
Classes
|
Represents a fan plot of the wavefront error for a given optic. |
- class OPDFan(optic: Optic, fields: Fields = 'all', wavelengths: Wavelengths = 'all', num_rays: int = 100, strategy: WavefrontStrategyType = 'chief_ray', remove_tilt: bool = False, **kwargs)[source]
Represents a fan plot of the wavefront error for a given optic.
- Parameters:
optic (Optic) – The optic for which the wavefront error is calculated.
fields (str or list, optional) – The fields for which the wavefront error is calculated. Defaults to ‘all’.
wavelengths (str or list, optional) – The wavelengths for which the wavefront error is calculated. Defaults to ‘all’.
num_rays (int, optional) – The number of rays used to calculate the wavefront error. Defaults to 100.
strategy (str) – The calculation strategy to use. Supported options are “chief_ray”, “centroid_sphere”, and “best_fit_sphere”. Defaults to “chief_ray”.
remove_tilt (bool) – If True, removes tilt and piston from the OPD data. Defaults to False.
**kwargs – Additional keyword arguments passed to the strategy.
- pupil_coord
The coordinates of the pupil.
- Type:
be.ndarray
- data
A nested list where data[field_idx][wavelength_idx] contains WavefrontData for that specific field and wavelength. This is populated by the parent Wavefront class.
- Type:
list
- static fit_and_remove_tilt(data: WavefrontData, remove_piston: bool = False, ridge: float = 1e-12) be.ndarray
Removes piston and tilt from OPD data using weighted least squares.
- Parameters:
data (WavefrontData) – The wavefront data containing pupil coordinates and OPD.
remove_piston (bool, optional) – If True, removes piston term as well as tilt. Defaults to False.
ridge (float, optional) – Small diagonal regularization for stability. Defaults to 1e-12.
- Returns:
OPD with piston and tilt removed, shape (N,).
- Return type:
opd_detrended (be.ndarray)
- get_data(field: tuple[float, float], wl: float) WavefrontData
Retrieves precomputed wavefront data for a field and wavelength.
- Parameters:
field (tuple[float, float]) – The field coordinates, or a FieldPoint.
wl (float) – The wavelength in µm, or a WavelengthPoint.
- Returns:
A data container with the computed wavefront results.
- Return type:
- view(fig_to_plot_on: Figure | None = None, figsize: tuple[float, float] = (10, 3)) tuple[Figure, NDArray][source]
Visualizes the wavefront error for different fields and wavelengths.
- Parameters:
fig_to_plot_on (plt.Figure, optional) – The figure to plot on.
figsize (tuple, optional) – The size of the figure. Defaults to (10, 3).
- Returns:
A tuple containing the figure and axes objects.
- Return type:
tuple
- Raises:
ValueError – If the number of fields is not equal to the number of
wavelengths, or if the number of fields is not equal to the –
number of rays. –