physical_apertures.elliptical
Elliptical Aperture Module
This module contains the EllipticalAperture class, which represents an elliptical aperture that clips rays based on their position.
Kramer Harrison, 2025
Classes
|
Represents an elliptical aperture that clips rays based on their position. |
- class EllipticalAperture(a, b, offset_x=0, offset_y=0)[source]
Represents an elliptical aperture that clips rays based on their position.
- a
The semi-major axis of the ellipse.
- Type:
float
- b
The semi-minor axis of the ellipse.
- Type:
float
- offset_x
The x-coordinate of the aperture’s center.
- Type:
float
- offset_y
The y-coordinate of the aperture’s center.
- Type:
float
- clip(rays: RealRays)
Clips the given rays based on the aperture’s shape.
- Parameters:
rays (RealRays) – List of rays to be clipped.
- Returns:
List of clipped rays.
- Return type:
list
- contains(x, y)[source]
Checks if the given point is inside the aperture.
- Parameters:
x (np.ndarray) – The x-coordinate of the point.
y (np.ndarray) – The y-coordinate of the point.
- Returns:
- Boolean array indicating if the point is inside the
aperture
- Return type:
np.ndarray
- property extent
Returns the extent of the aperture.
- Returns:
The extent of the aperture in the x and y directions.
- Return type:
tuple
- classmethod from_dict(data)[source]
Create an aperture from a dictionary representation.
- Parameters:
data (dict) – The dictionary representation of the aperture.
- Returns:
The aperture object.
- Return type:
- scale(scale_factor)[source]
Scales the aperture by the given factor.
- Parameters:
scale_factor (float) – The factor by which to scale the aperture.
- to_dict()[source]
Convert the aperture to a dictionary.
- Returns:
The dictionary representation of the aperture.
- Return type:
dict
- view(nx: int = 256, ny: int = 256, ax: Axes | None = None, buffer: float = 1.1, **kwargs) tuple[Figure, Axes]
Visualize the aperture.
- Parameters:
nx (int) – The number of points in the x-direction.
ny (int) – The number of points in the y-direction.
ax (Axes) – The axes to plot on.
buffer (float) – The buffer around the aperture.
**kwargs – Additional keyword arguments to pass to the plot function.
- Returns:
A tuple containing the figure and axes objects.
- Return type:
tuple