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

Pickup(optic, source_surface_idx, attr_type, ...)

A class representing a pickup on an optic surface

PickupManager(optic)

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.

classmethod from_dict(optic, data)[source]

Creates a Pickup object from a dictionary representation.

Parameters:
  • optic (Optic) – The optic object on which the pickup operation is performed.

  • data (dict) – A dictionary representation of the pickup operation.

Returns:

A Pickup object created from the dictionary representation.

Return type:

Pickup

to_dict()[source]

Returns a dictionary representation of the pickup operation.

Returns:

A dictionary representation of the pickup operation.

Return type:

dict

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]

Adds a new pickup operation to the manager.

apply()[source]

Applies all pickup operations in the manager.

clear()[source]

Clears all pickup operations in the manager.

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

apply()[source]

Applies all pickup operations in the manager.

clear()[source]

Clears all pickup operations in the manager.

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:

PickupManager

remap_surface_indices(remap_func)[source]

Remaps the source and target surface indices of all pickups.

Parameters:

remap_func (callable) – A function that takes an old surface index and returns a new surface index.

to_dict()[source]

Returns a dictionary representation of the pickup manager.

Returns:

A dictionary representation of the pickup manager.

Return type:

dict