pickup
Pickup Module
The pickup module contains classes for managing and performing pickup operations on an optic surface. A pickup operation involves copying an attribute value from one surface to another surface, optionally scaling and offsetting the value.
It also supports generic pickups between arbitrary attributes of any Optic instance.
Kramer Harrison, 2024
Classes
|
A class representing a pickup on an optic surface |
|
A class for managing multiple pickup operations on an optic surface |
- class Pickup(optic, source_surface_idx, attr_type, target_surface_idx, scale=1, offset=0, source_optic=None)[source]
A class representing a pickup on an optic surface
- Parameters:
optic (Optic) – The optic object on which the pickup operation is performed.
source_surface_idx (int) – The index of the source surface in the optic’s surface group.
attr_type (str) – The type of attribute to be picked up (‘radius’, ‘conic’, or ‘thickness’). Can also be a generic path, where [i] should be used to indicate the surface index (e.g. surfaces.surfaces[i].geometry.coefficients).
target_surface_idx (int) – The index of the target surface in the optic’s surface group.
scale (float, optional) – The scaling factor applied to the picked up value. Defaults to 1.
offset (float, optional) – The offset added to the picked up value. Defaults to 0.
source_optic (Optic, optional) – The source optic to pick up from. Defaults to None (uses self.optic).
- apply()[source]
Applies the pickup operation by scaling and offsetting the picked up value and setting it on the target surface.
- Raises:
ValueError – If an invalid source attribute is specified.
- apply()[source]
Updates the target surface based on the source surface attribute.
This method calculates the new value by multiplying the current value by the scale factor and adding the offset. The new value is then set on the target surface.
- class PickupManager(optic)[source]
A class for managing multiple pickup operations on an optic surface
- Parameters:
optic (Optic) – The optic object on which the pickup operations are performed.
- pickups
A list of Pickup objects representing the pickup operations to be performed.
- Type:
list
- add(source_surface_idx, attr_type, target_surface_idx, scale=1, offset=0, source_optic=None)[source]
Adds a new pickup operation to the manager.
- Parameters:
source_surface_idx (int) – The index of the source surface in the optic’s surface group.
attr_type (str) – The type of attribute to be picked up (‘radius’, ‘conic’, or ‘thickness’). Can also be a generic path, where [i] should be used to indicate the surface index (e.g. surfaces.surfaces[i].geometry.coefficients).
target_surface_idx (int) – The index of the target surface in the optic’s surface group.
scale (float, optional) – The scaling factor applied to the picked up value. Defaults to 1.
offset (float, optional) – The offset added to the picked up value. Defaults to 0.
source_optic (Optic, optional) – The generic source optic. Defaults to None (same optic).
- classmethod from_dict(optic, data)[source]
Creates a PickupManager object from a dictionary representation.
- Parameters:
optic (Optic) – The optic object on which the pickup operations are performed.
data (dict) – A dictionary representation of the pickup manager.
- Returns:
- A PickupManager object created from the dictionary
representation.
- Return type: