optimization.variable.tilt#

Tilt Variable Module

This module contains the TiltVariable class, which represents a variable for the tilt of an optic surface. The tilt variable can be used to optimize the tilt of a surface in an optical system.

Kramer Harrison, 2024

Classes

TiltVariable(optic, surface_number, axis[, ...])

Represents a variable for the tilt of an optic surface.

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

Represents a variable for the tilt of an optic surface.

Parameters:
  • optic (Optic) – The optic object to which the surface belongs.

  • surface_number (int) – The number of the surface.

  • axis (str) – The axis of the tilt. Valid values are ‘x’ and ‘y’.

  • scaler (Scaler) – The scaler to use for the variable. Defaults to IdentityScaler().

  • **kwargs – Additional keyword arguments.

Variables:
  • optic (Optic) – The optic object to which the surface belongs.

  • surface_number (int) – The number of the surface.

Methods:
  • get_value() – Returns the current tilt value of the surface.

  • update_value (new_value) – Updates the tilt value of the surface.

get_value()[source]#

Returns the current tilt value of the surface.

Returns:

The current tilt value.

Return type:

float

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 tilt value of the surface.

Parameters:

new_value (float) – The new tilt value.