multiconfig.multi_configuration
Multi-Configuration Module
This module provides the MultiConfiguration class for managing optical systems with multiple configurations, such as zoom lenses.
Kramer Harrison, 2025
Classes
|
Manages multiple configurations of an optical system. |
- class MultiConfiguration(base_optic: Optic)[source]
Manages multiple configurations of an optical system.
This class holds a list of independent Optic instances, one for each configuration. It provides methods to create new configurations derived from a base configuration and link them using Pickups.
- Parameters:
base_optic (Optic) – The initial optical system (Configuration 0).
- add_configuration(source_config_idx: int = 0) Optic[source]
Creates a new configuration based on a source configuration.
The new configuration is a deep copy of the source. By default, Pickups are added to the new configuration that link all its surface geometries and basic properties back to the source. This ensures that, initially, both configurations are identical and controlled by the source’s variables.
- Parameters:
source_config_idx (int) – The index of the configuration to copy. Defaults to 0.
- Returns:
The new configuration instance.
- Return type:
- draw(figsize: tuple[float, float] | None = None, sharex: bool = True, sharey: bool = True, **kwargs)[source]
Draw the multi-configuration system.
- Parameters:
figsize – The size of the figure for a SINGLE configuration. The total figure height will be scaled by the number of configs. If None, uses the active theme’s default figsize.
sharex – If True, share the x-axis limits and labels.
sharey – If True, share the y-axis limits and labels.
**kwargs – Additional arguments passed to OpticViewer.view().
- set_conic(surface_index: int, value: float, configurations: list[int] | Literal['all'] = 'all')[source]
Set the conic constant of a surface.
- set_material(surface_index: int, value: str | BaseMaterial, configurations: list[int] | Literal['all'] = 'all')[source]
Set the material of a surface.
- set_optic_property(attribute_path: str, value: Any, configurations: list[int] | Literal['all'] = 'all')[source]
Convenience wrapper for set_property on the optic.
- set_property(value: Any, configurations: list[int] | Literal['all'] = 'all', surface_index: int | None = None, attribute_path: str = None)[source]
Set a property value across one or more configurations.
- Parameters:
value – The value to set.
configurations – A list of configuration indices to update, or “all” to update the base configuration and ensure links (pickups) exist (or are created) for other configurations.
surface_index – The index of the surface to modify. If None, the property is assumed to be on the Optic itself.
attribute_path – The dot-separated path to the attribute, or a known alias (‘radius’, ‘thickness’, ‘conic’, ‘material’).
- set_radius(surface_index: int, value: float, configurations: list[int] | Literal['all'] = 'all')[source]
Set the radius of a surface.