BeamPath
The BeamPath
is the main abstraction for the Lightpath module,
grouping together a set of devices using the Lightpath
interface and representing the path between them as single
object. The manipulation of each of these object should be done at the device
level, and while this may be done inside of Lightpath via detailed screens,
Lightpath is not responsible for inserting or removing devices.
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
secretly affecting the beam.
- class lightpath.path.LightpathState(inserted: bool, removed: bool, output: dict[str, float])[source]
The lightpath-relevant state of a device. Devices must return an instance of this dataclass via the
get_lightpath_state()
method.- inserted
- Type:
bool
- removed
- Type:
bool
- output
mapping from output branch to transmission
- Type:
Dict[str, float]
- class lightpath.path.BeamPath(*devices: OphydObject, minimum_transmission: float = 0.1, name: str | None = 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.name (str, optional) – 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
Minimum amount of transmission considered for beam presence
- Type:
float
- property blocking_devices: list[Device]
A list of devices that are currently inserted or are in unknown positions. This includes devices downstream of the first
impediment
.- Returns:
list of blocking devices
- Return type:
List[Device]
- property branching_devices: list[Device]
Branching devices along the path
- Type:
List[Device]
- clear(wait: bool = False, timeout: float | None = None, ignore: list[Device] | None = None, passive: bool = False) list[DeviceStatus] [source]
Clear the beampath of all obstructions
- Parameters:
wait (bool, optional) – 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:
statuses – Returns list of status objects returned by
LightInterface.remove()
- Return type:
List[ophyd.DeviceStatus]
- clear_device_subs() None [source]
Clears the ._device_moved callbacks from all devices in the path. Distinct from BeamPath.clear_sub, which unsubscribes a specific callback from the BeamPath object itself.
- property cleared: bool
Whether beamline is clear of any devices that are below the
minimum_transmission
- Returns:
whether beamline is clear of impediments
- Return type:
bool
- classmethod from_join(*beampaths: BeamPath, name: str | None = None) BeamPath [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:
- Raises:
TypeError: – Raised if a non-BeamPath object is supplied
- get_device_output(dev: Device) tuple[str, float] [source]
Find relevant output item by attempting to match with the input branch of the next device in this path.
- Parameters:
dev (Device) – device in this path to get output from
- property impediment: Device
First blocking device along the path
- Type:
Device
- property incident_devices: list[Device]
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 thanminimum_transmission
- Returns:
List of incident devices
- Return type:
List[Device]
- join(*beampaths: BeamPath) BeamPath [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:
- Raises:
TypeError: – Raised if a non-BeamPath object is supplied
- property path: list[Device]
List of devices ordered by coordinates
- Type:
List[Device]
- property range: tuple[float, float]
Starting z position of beamline
- Type:
Tuple[float, float]
- show_devices(file: TextIO | None = None)[source]
Print a table of the devices along the beamline
- Parameters:
file (TextIO) – File-like object to write output to. Default behavior is printing to sys.stdout