geometries.base
Base Geometry
The base geometry class for all geometries. Geometries are used to define the shape of optical elements.
Kramer Harrison, 2024
Classes
|
Base geometry for all geometries. |
- class BaseGeometry(coordinate_system)[source]
Base geometry for all geometries.
- Parameters:
cs (CoordinateSystem) – The coordinate system of the geometry.
- abstract distance(rays)[source]
Find the propagation distance to the geometry.
- Parameters:
rays (RealRays) – The rays for which to calculate the distance to the geometry.
- Returns:
An array of propagation distances from each ray’s current position to the geometry surface along the ray’s direction.
- Return type:
be.ndarray
- abstract flip()[source]
Flip the geometry.
This method should modify the geometry parameters such that the curvature is inverted. For example, the radius of curvature should change sign. Conic constants and polynomial coefficients should not change. The coordinate system of the geometry should not be modified.
- classmethod from_dict(data)[source]
Create a geometry from a dictionary.
- Parameters:
data (dict) – A dictionary containing the geometry data, including its ‘type’ and coordinate system ‘cs’.
- Returns:
An instance of a specific geometry subclass created from the dictionary data.
- Return type:
- globalize(rays)[source]
Convert rays from the local coordinate system to the global coordinate system.
- Parameters:
rays (RealRays) – The rays to convert.
- localize(rays)[source]
Convert rays from the global coordinate system to the local coordinate system.
- Parameters:
rays (RealRays) – The rays to convert.
- abstract sag(x=0, y=0)[source]
Calculate the surface sag of the geometry.
- Parameters:
x (float or be.ndarray, optional) – The x-coordinate(s). Defaults to 0.
y (float or be.ndarray, optional) – The y-coordinate(s). Defaults to 0.
- Returns:
The surface sag of the geometry at the given coordinates.
- Return type:
float or be.ndarray
- abstract scale(scale_factor: float)[source]
Scale the geometry parameters.
- Parameters:
scale_factor (float) – The factor by which to scale the geometry.
- set_radius(value: float) None[source]
Set the radius of curvature.
- Parameters:
value (float) – The new radius of curvature.
- Raises:
AttributeError – If the geometry type does not support setting a radius.
- abstract surface_normal(rays)[source]
Find the surface normal of the geometry at the given ray positions.
- Parameters:
rays (RealRays) – The rays, positioned at the surface, for which to calculate the surface normal.
- Returns:
A tuple containing three arrays (nx, ny, nz) representing the x, y, and z components of the surface normals at each ray’s intersection point.
- Return type:
tuple[be.ndarray, be.ndarray, be.ndarray]
- to_dict()[source]
Convert the geometry to a dictionary.
- Returns:
The dictionary representation of the geometry.
- Return type:
dict
- update_normalization(semi_aperture: float) None[source]
Update the normalization attributes of the geometry based on its defined normalization_mode (‘auto’ or ‘manual’). Base geometry generally does not maintain a normalization radius.
- Parameters:
semi_aperture (float) – The current semi-aperture of the surface.