BeamPath

The BeamPath is the main abstraction for the lightpath module, grouping together a set of devices using the LightInterface and representing the path between them as single object. While the manipulation of each of these object should be done at the device level, the BeamPath.clear() does provide a powerful tool to quickly change the status of the path.

The BeamPath object is also not meant to be a rigid representation, BeamPath.split() and BeamPath.join() both allow for slicing and combining of different areas of the LCLS beamline. However, keep in mind that the path only knows the state of the devices it contains, so certain methods might not return an accurate representation of reality if an upstream device is affecting the beam.

class lightpath.path.BeamPath(*devices, name=None)[source]

Represents a straight line of devices along the beamline

The devices given must be a continuous set all along the same beamline, or, multiple beamlines with appropriate reflecting devices in between.

Parameters:
  • devices (LightDevice) – Arguments are interpreted as LightDevices along a common beamline.
  • = str, optional (name) – Name of the BeamPath
Raises:
  • TypeError: – If a non-LightDevice object is supplied
  • CoordinateError: – If a coordinate is not properly specified
  • PathError: – If multiple beamlines are present, with no reflecting device
minimum_transmission

float – Minimum amount of transmission considered for beam presence

blocking_devices

A list of devices that are currently inserted or are in unknown positions. This includes devices downstream of the first impediment

branches

Branching devices along the path

clear(wait=False, timeout=None, passive=False, ignore=None)[source]

Clear the beampath of all obstructions

Parameters:
  • wait (bool) – Wait for all devices to complete their motion
  • timeout (float, optional) – Duration to wait for device movements
  • ignore (device or iterable, optional) – Leave devices in their current state without removing them
  • passive (bool, optional) – If False, devices that are inserted but don’t attenuate the beam below minimum_threshold are ignored
Returns:

Returns list of status objects returned by LightInterface.remove()

Return type:

statuses

cleared

Whether beamline is clear of any devices that are below the minimum_transmission

classmethod from_join(*beampaths, name=None)[source]

Join other beampaths with the current one

Parameters:
  • beampaths (arguments) – A list of beampaths to join into a complete path, order is irrelavant
  • name (str, optional) – New name for created beampath
Returns:

BeamPath – A new object with all of the path devices

Return type:

BeamPath

Raises:

TypeError: – Raised if a non-BeamPath object is supplied

impediment

First blocking device along the path

incident_devices

A list of devices the beam is currently incident on. This includes the current impediment and any upstream devices that may be inserted but have more transmission than minimum_transmission

join(*beampaths)[source]

Join multiple beampaths with the current one

Parameters:beampaths (arguments) – A list of beampaths to join into a complete path, order is irrelavant
Returns:BeamPath – A new object with all of the path devices
Return type:BeamPath
Raises:TypeError: – Raised if a non-BeamPath object is supplied
path

List of devices ordered by coordinates

range

Starting z position of beamline

show_devices(file=None)[source]

Print a table of the devices along the beamline

Parameters:file (file-like object) – File to writable
split(z=None, device=None)[source]

Split the beampath producing two new BeamPath objects either by a specific position or a devices location

Parameters:
  • z (float) – Z position to split the paths
  • device (LightDevice, name, or base PV) – The specified device will be the last device in the first BeamPath object
Returns:

Two new beampath instances

Return type:

BeamPath, BeamPath

subscribe(cb, event_type=None, run=True)[source]

Subscribe to changes of the valve

Parameters:
  • cb (callable) – Callback to be run
  • event_type (str, optional) – Type of event to run callback on
  • run (bool, optional) – Run the callback immediatelly