tolerancing.core
Core Tolerancing Module
This module contains the core classes for the tolerancing module. The Tolerancing class is the main class for defining a tolerancing problem. It allows the user to add operands, perturbations, and compensators to an optical system.
Kramer Harrison, 2024
Classes
|
Evaluates a set of named operands against an Optic instance. |
|
A class representing a tolerancing problem. |
- class OperandEvaluator(operands: list[Operand])[source]
Evaluates a set of named operands against an Optic instance.
- Parameters:
operands – List of Operand objects to evaluate.
- class Tolerancing(optic, method='generic', tol=1e-05)[source]
A class representing a tolerancing problem. This class is the core of the tolerancing module. It allows the user to define a tolerancing problem by adding operands (metrics), perturbations, and compensators to an optical system.
- Parameters:
optic – The optic object to be toleranced.
method – The method to use for optimization. Defaults to ‘generic’.
tol – The tolerance for the compensator optimizer. Defaults to 1e-5.
- optic
The optic object to be toleranced.
- method
The method to use for optimization. Defaults to ‘generic’.
- tol
The tolerance for the compensator optimizer. Defaults to 1e-5.
- _optic_nominal
A deep copy of the optic object representing its nominal state.
- operands
A list of operands in the tolerancing problem.
- perturbations
A list of perturbations applied to the optic.
- compensator
An optimizer for compensating the perturbations.
- add_perturbation(self, variable_type, perturbation, **kwargs)[source]
Adds a perturbation to the optic.
- add_compensator(self, variable_type, **kwargs)[source]
Adds a compensator variable to the optimizer.
- add_compensator(variable_type: str, **kwargs)[source]
Add a compensator variable to the optimizer.
- Parameters:
variable_type – The type of the variable to be used for compensation, such as “thickness”, etc. See the variable module for more information.
**kwargs – Additional keyword arguments for the variable.
- add_operand(operand_type: str, input_data: dict = None, target: float = None, weight: float = 1.0, min_val: float = None, max_val: float = None)[source]
Add an operand to the tolerancing problem.
- Parameters:
operand_type (str) – The type of the operand.
target (float) – The target value of the operand (equality operand).
min_val (float) – The operand should stay above this value (inequality operand).
max_val (float) – The operand should stay below this value (inequality operand).
weight (float) – The weight of the operand.
input_data (dict) – Additional input data for the operand.
- add_perturbation(variable_type: str, sampler: BaseSampler, **kwargs)[source]
Add a perturbation to the optic.
- Parameters:
variable_type – The type of the variable to be perturbed, such as “radius”, “thickness”, etc. See the variable module for more information.
sampler – The sampler object used to generate perturbation values.
**kwargs – Additional keyword arguments for the variable.