analysis.rms_vs_field#
RMS versus Field Analysis
This module enables the calculation of both the RMS spot size and the RMS wavefront error versus field coordinate of an optical system.
Kramer Harrison, 2024
Classes
|
RMS Spot Size versus Field Coordinate. |
|
RMS Wavefront Error versus Field Coordinate. |
- class RmsSpotSizeVsField(optic, num_fields: int = 64, wavelengths='all', num_rings: int = 6, distribution: str = 'hexapolar')[source]#
RMS Spot Size versus Field Coordinate.
This class is used to analyze the RMS spot size versus field coordinate of an optical system.
- Parameters:
- airy_disc_x_y(wavelength: float) tuple[list[float], list[float]]#
Generates the Airy disk radii for the x and y axes for each field.
- Parameters:
wavelength – The wavelength for the calculation.
- Returns:
x-axis radii and y-axis radii per field.
- Return type:
A tuple of two lists
- airy_radius(n_w: float, wavelength: float) float#
Calculates the Airy disk radius.
- Parameters:
n_w – The physical F-number.
wavelength – The wavelength of light in micrometers.
- Returns:
The Airy disk radius.
- angle_from_cosine(a: BEArray, b: BEArray) float#
Calculates the angle in radians between two direction cosine vectors.
- Parameters:
a – The first direction cosine vector.
b – The second direction cosine vector.
- Returns:
The angle between the vectors in radians.
- centroid() list[tuple[BEArray, BEArray]]#
Calculates the geometric centroid of each spot for the reference wavelength.
- Returns:
A list of (x, y) centroid coordinates for each field.
- f_number(n: float, theta: float) float#
Calculates the physical F-number.
- Parameters:
n – The refractive index of the medium.
theta – The half-angle of the cone of light in radians.
- Returns:
The calculated physical F-number.
- generate_chief_rays_centers(wavelength: float) BEArray#
Generates the (x, y) intersection points for the chief ray of each field.
- Parameters:
wavelength – The wavelength for the rays.
- Returns:
An array of shape (num_fields, 2) with (x, y) coordinates.
- generate_chief_rays_cosines(wavelength: float) BEArray#
Generates direction cosines for the chief ray of each field.
- Parameters:
wavelength – The wavelength for the rays.
- Returns:
An array of shape (num_fields, 3) containing the direction cosines.
- generate_marginal_rays(H_x: float, H_y: float, wavelength: float) tuple#
Generates marginal rays at the four cardinal points of the pupil.
- Parameters:
H_x – The x-field coordinate.
H_y – The y-field coordinate.
wavelength – The wavelength for the rays.
- Returns:
A tuple containing the traced rays for north, south, east, and west pupil points.
- generate_marginal_rays_cosines(H_x: float, H_y: float, wavelength: float) tuple#
Generates direction cosines for each marginal ray of a given field.
- Parameters:
H_x – The x-field coordinate.
H_y – The y-field coordinate.
wavelength – The wavelength for the rays.
- Returns:
A tuple of direction cosine vectors for north, south, east, and west rays.
- geometric_spot_radius() list[list[BEArray]]#
Calculates the maximum geometric spot radius for each spot.
- Returns:
A nested list of maximum radii for each field and wavelength.
- rms_spot_radius() list[list[BEArray]]#
Calculates the root-mean-square (RMS) spot radius for each spot.
- Returns:
A nested list of RMS radii for each field and wavelength.
- view(fig_to_plot_on: Figure | None = None, figsize: tuple[float, float] = (7, 4.5), *, show: bool = True) tuple[Figure, Axes][source]#
Plots the RMS spot size versus the normalized Y field coordinate for each analysis wavelength.
Parameters#
- fig_to_plot_onplt.Figure, optional
An existing matplotlib Figure to plot on. If provided, the plot will be embedded in this figure. If None (default), a new figure will be created.
- figsizetuple of float, optional
Size of the figure to create if fig_to_plot_on is None. Default is (7, 4.5).
- showbool, optional
If True (default), calls plt.show(). Set False for headless use.
Returns#
- tuple[Figure, Axes]
The matplotlib Figure and Axes objects containing the plot.
Notes#
Each wavelength’s RMS spot size is plotted as a separate line for clarity and legend handling.
The legend is placed outside the plot area for better readability.
The method is suitable for both standalone plotting and GUI embedding.
- class RmsWavefrontErrorVsField(optic: Optic, num_fields: int = 32, wavelengths: str = 'all', num_rays: int = 12, distribution: str = 'hexapolar')[source]#
RMS Wavefront Error versus Field Coordinate.
This class is used to analyze the RMS wavefront error versus field coordinate of an optical system.
- Parameters:
- 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)