solves.factory
Solve Factory Module
Factory for creating solve objects.
Kramer Harrison, 2025
Classes
Factory class for creating solves. |
- class SolveFactory[source]
Factory class for creating solves.
This factory uses a predefined map to find and instantiate the appropriate solve class based on the provided solve_type.
- static create_solve(optic, solve_type: str, surface_idx, *args, **kwargs)[source]
Creates a solve instance based on the given solve type.
- Parameters:
optic (Optic) – The optic object to which the solve will be applied.
solve_type (str) – The type of solve to create (e.g., ‘marginal_ray_height’, ‘quick_focus’, ‘chief_ray_height’).
surface_idx (int) – The index of the surface relevant to the solve. May not be used by all solve types (e.g., ‘quick_focus’).
*args – Variable length argument list. For height-based solves, the first argument (args[0]) is expected to be the height.
**kwargs – Arbitrary keyword arguments. (Currently unused in favor of positional arguments for height).
- Returns:
An instance of the solve class corresponding to the given solve type.
- Raises:
ValueError – If the solve type is invalid or if required arguments for a specific solve type are missing or invalid.