optimization.variable.norm_radius#

This module provides variable handling for normalization radius parameters.

The normalization radius is used in certain optical surface representations (like Forbes polynomials) to control the scaling of the surface coordinates. It contains the NormalizationRadiusVariable class for use in optimization problems.

Manuel Fragata Mendes, August 2025

Classes

NormalizationRadiusVariable(optic, ...[, scaler])

Represents a variable for the normalization radius of a surface.

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

Represents a variable for the normalization radius of a surface.

get_value()[source]#

Returns the current value of the normalization radius.

inverse_scale(scaled_value)#

Inverse scale the value of the variable.

Parameters:

scaled_value – The scaled value to inverse scale

release_graph()#

Drop the autograd graph that the last update left in the optic.

A Torch optimizer calls this for all variables before it writes the values of a new step (VariableManager.release_graphs). A variable that writes one entry of an array, which other variables can share (a coefficient array), must start each step from plain values. Otherwise the array still holds the graph of the last step: the next backward pass then runs into that freed graph and fails, or the graph grows with each step.

The default does nothing: a variable that replaces a whole attribute leaves no old graph behind.

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 value of the normalization radius.