optimization.variable.forbes_coeff#

Specialized variable handlers for Forbes polynomial coefficients.

This module provides handlers for Forbes polynomial coefficients, distinguishing between rotationally symmetric (slope-orthogonal Q) and freeform (Q-2D) surfaces.

Manuel Fragata Mendes, August 2025

Classes

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

Represents a variable for a Forbes Q-2D (freeform) coefficient.

ForbesQNormalSlopeCoeffVariable(optic, ...)

Represents a variable for a Forbes Q (slope-orthogonal) coefficient.

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

Deprecated alias for ForbesQNormalSlopeCoeffVariable.

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

Represents a variable for a Forbes Q-2D (freeform) coefficient.

This variable targets the coefficient c corresponding to a specific (type, m, n) term, following the Zemax convention.

Variables:
  • attribute (str) – The name of the attribute holding the coefficients.

  • m (int) – The azimuthal frequency m.

  • n (int) – The radial order n.

  • term_type (str) – The type of term (‘cos’ or ‘sin’).

  • coeff_tuple (tuple) – The identifier for the coefficient.

get_value()[source]#

Gets the value of the coefficient for the specified term.

Returns:

The value of the coefficient.

Return type:

float

Raises:

TypeError – If the geometry is not a ForbesQ2dGeometry.

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 value of the coefficient for the specified term.

Parameters:

new_value (float) – The new value for the coefficient.

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

Represents a variable for a Forbes Q (slope-orthogonal) coefficient.

This variable targets a coefficient for a specific radial order n.

Variables:

coeff_number (int) – The radial order ‘n’ of the coefficient.

get_value()[source]#

Gets the value of the nth Q (slope-orthogonal) coefficient.

Returns:

The value of the coefficient.

Return type:

float

Raises:

TypeError – If the geometry is not a ForbesQNormalSlopeGeometry.

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 value of the nth Q (slope-orthogonal) coefficient.

Parameters:

new_value (float) – The new value for the coefficient.

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

Deprecated alias for ForbesQNormalSlopeCoeffVariable.

Deprecated since version Use: ForbesQNormalSlopeCoeffVariable instead.

get_value()#

Gets the value of the nth Q (slope-orthogonal) coefficient.

Returns:

The value of the coefficient.

Return type:

float

Raises:

TypeError – If the geometry is not a ForbesQNormalSlopeGeometry.

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)#

Updates the value of the nth Q (slope-orthogonal) coefficient.

Parameters:

new_value (float) – The new value for the coefficient.