physical_apertures.base
Physical Apertures Base Module
This module contains the base classes for physical apertures. The BaseAperture class is an abstract base class that defines the interface for physical apertures. The BaseBooleanAperture class is an abstract base class for boolean operations on apertures. The UnionAperture, IntersectionAperture, and DifferenceAperture classes are concrete classes that implement the union, intersection, and difference of two apertures, respectively.
Kramer Harrison, 2024
Classes
Base class for physical apertures. |
|
|
Base class for boolean operations on apertures. |
|
Class for difference of two apertures. |
|
Class for intersection of two apertures. |
|
Class for union of two apertures. |
- class BaseAperture[source]
Base class for physical apertures.
- clip(rays: RealRays)[source]
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
- abstract contains(x: BEArray, y: BEArray) BEArray[source]
Checks if the given point is inside the aperture.
- Parameters:
x (be.ndarray) – The x-coordinate of the point.
y (be.ndarray) – The y-coordinate of the point.
- Returns:
- Boolean array indicating if the point is inside the
aperture
- Return type:
be.ndarray
- abstract property extent: tuple[float, float, float, float]
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: dict) BaseAperture[source]
Create an aperture from a dictionary representation.
- Parameters:
data (dict) – The dictionary representation of the aperture.
- Returns:
The aperture object.
- Return type:
- abstract scale(scale_factor: float)[source]
Scales the aperture by the given factor.
- Parameters:
scale_factor (float) – The factor by which to scale the aperture.
- to_dict() 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][source]
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
- class BaseBooleanAperture(a: BaseAperture, b: BaseAperture)[source]
Base class for boolean operations on apertures.
- Parameters:
a (BaseAperture) – The first aperture.
b (BaseAperture) – The second aperture.
- 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
- abstract contains(x, y) BEArray[source]
Checks if the given point is inside the aperture.
- Parameters:
x (be.ndarray) – The x-coordinate of the point.
y (be.ndarray) – The y-coordinate of the point.
- Returns:
- Boolean array indicating if the point is inside the
aperture
- Return type:
be.ndarray
- property extent: tuple[float, float, float, float]
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: dict)[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: float)[source]
Scales the aperture by the given factor.
- Parameters:
scale_factor (float) – The factor by which to scale the aperture.
- to_dict() 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
- class DifferenceAperture(a: BaseAperture, b: BaseAperture)[source]
Class for difference of two apertures.
- Parameters:
a (BaseAperture) – The first aperture.
b (BaseAperture) – The second aperture.
- 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: BEArray, y: BEArray) BEArray[source]
Checks if the given point is inside the aperture.
- Parameters:
x (be.ndarray) – The x-coordinate of the point.
y (be.ndarray) – The y-coordinate of the point.
- Returns:
- Boolean array indicating if the point is inside the
aperture
- Return type:
be.ndarray
- property extent: tuple[float, float, float, float]
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: dict)
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: float)
Scales the aperture by the given factor.
- Parameters:
scale_factor (float) – The factor by which to scale the aperture.
- to_dict() dict
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
- class IntersectionAperture(a: BaseAperture, b: BaseAperture)[source]
Class for intersection of two apertures.
- Parameters:
a (BaseAperture) – The first aperture.
b (BaseAperture) – The second aperture.
- 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: BEArray, y: BEArray) BEArray[source]
Checks if the given point is inside the aperture.
- Parameters:
x (be.ndarray) – The x-coordinate of the point.
y (be.ndarray) – The y-coordinate of the point.
- Returns:
- Boolean array indicating if the point is inside the
aperture
- Return type:
be.ndarray
- property extent: tuple[float, float, float, float]
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: dict)
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: float)
Scales the aperture by the given factor.
- Parameters:
scale_factor (float) – The factor by which to scale the aperture.
- to_dict() dict
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
- class UnionAperture(a: BaseAperture, b: BaseAperture)[source]
Class for union of two apertures.
- Parameters:
a (BaseAperture) – The first aperture.
b (BaseAperture) – The second aperture.
- 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: BEArray, y: BEArray) BEArray[source]
Checks if the given point is inside either aperture.
- Parameters:
x (be.ndarray) – The x-coordinate of the point.
y (be.ndarray) – The y-coordinate of the point.
- Returns:
- Boolean array indicating if the point is inside the
aperture
- Return type:
be.ndarray
- property extent: tuple[float, float, float, float]
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: dict)
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: float)
Scales the aperture by the given factor.
- Parameters:
scale_factor (float) – The factor by which to scale the aperture.
- to_dict() dict
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