optimization.variable.reciprocal_radius

Reciprocal Radius Variable Module

This module contains the ReciprocalRadiusVariable class, which represents a variable for the reciprocal of the radius of a surface in an optic. The transformation is useful because a nearly flat surface (with a very large positive or negative radius) has a reciprocal near zero, which makes the optimization around a nearly flat surface continuous. The reciprocal radius provides a continuous transition when surface changes from convex to concave (when the radius changes sign).

Daniel Miranda, 2025 ALL rights ceded to Kramer Harrison

Classes

ReciprocalRadiusVariable(optic, surface_number)

Represents a variable for the reciprocal of the radius of a surface in an optic.

class ReciprocalRadiusVariable(optic, surface_number, scaler=None, **kwargs)[source]

Represents a variable for the reciprocal of the radius of a surface in an optic.

Parameters:
  • optic (Optic) – The optic object that contains the surface.

  • surface_number (int) – The index of the surface in the optic.

  • scaler (Scaler) – The scaler to use for the variable. Defaults to a linear scaler with factor=10.0.

  • **kwargs – Additional keyword arguments.

optic

The optic object that contains the surface.

Type:

Optic

surface_number

The index of the surface in the optic.

Type:

int

get_value()[source]

Returns the current value of the reciprocal radius.

update_value(new_value)[source]

Updates the value via the reciprocal, converting back to radius.

get_value()[source]

Returns the current value of the reciprocal of the radius.

Returns:

The current reciprocal radius.

Return type:

float

inverse_scale(scaled_value)

Inverse scale the value of the variable.

Parameters:

scaled_value – The scaled value to inverse scale

scale(value)

Scale the value of the variable for improved optimization performance.

Parameters:

value – The value to scale

update_value(new_value)[source]

Updates the surface radius based on the new reciprocal variable value.

Parameters:

new_value (float) – The new reciprocal radius value.