geometries.newton_raphson
Newton Raphson Geometry
The Newton Raphson geometry represents a surface utilizing the Newton-Raphson method for ray tracing. This is an abstract base class that should be inherited by any geometry that uses the Newton-Raphson method for ray tracing.
Kramer Harrison, 2024
Classes
|
Represents a geometry that uses the Newton-Raphson method for ray tracing. |
- class NewtonRaphsonGeometry(coordinate_system, radius, conic=0.0, tol=1e-10, max_iter=100)[source]
Represents a geometry that uses the Newton-Raphson method for ray tracing.
- Parameters:
coordinate_system (CoordinateSystem) – The coordinate system of the geometry.
radius (float) – The radius of curvature of the base sphere.
conic (float, optional) – The conic constant of the base sphere. Defaults to 0.0.
tol (float, optional) – Tolerance for Newton-Raphson iteration. Defaults to 1e-10.
max_iter (int, optional) – Maximum iterations for Newton-Raphson. Defaults to 100.
- distance(rays)[source]
Calculates the distance from the ray origin to the surface intersection using a robust Newton-Raphson method. This version uses the base conic intersection as a strong initial guess.
- Parameters:
rays (RealRays) – The rays used for calculating distance.
- Returns:
An array of propagation distances ‘t’ from each ray’s current position to its intersection point with the geometry.
- Return type:
be.ndarray
- flip()[source]
Flip the geometry.
Changes the sign of the radius of curvature. The conic constant remains unchanged.
- classmethod from_dict(data)[source]
Creates a geometry from a dictionary representation.
- Parameters:
data (dict) – The dictionary representation of the geometry.
- Returns:
An instance of a subclass of NewtonRaphsonGeometry, created from the dictionary data.
- Return type:
- globalize(rays)
Convert rays from the local coordinate system to the global coordinate system.
- Parameters:
rays (RealRays) – The rays to convert.
- localize(rays)
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
- scale(scale_factor: float)
Scale the geometry parameters.
- Parameters:
scale_factor (float) – The factor by which to scale the geometry.
- set_radius(value: float) None
Set the radius of curvature.
- Parameters:
value (float) – The new radius of curvature.
- surface_normal(rays)[source]
Calculates the surface normal of the geometry at the given rays.
- Parameters:
rays (RealRays) – The rays, positioned at the surface, for which to calculate the surface normal.
- Returns:
The surface normal components (nx, ny, nz).
- Return type:
tuple[be.ndarray, be.ndarray, be.ndarray]
- to_dict()[source]
Converts the geometry to a dictionary.
- Returns:
The dictionary representation of the geometry.
- Return type:
dict
- update_normalization(semi_aperture: float) None
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.