Device Containers

Device

A generic device container is available for use that holds a few basic traits pertinent to all LCLS devices. Largely this is available to provide a common base that more specific devices will inherit from.

class happi.Device(**kwargs)

A Generic Device Container

The class does not need to be intialized with any specific piece of information, but all of the attributes listed by Device.info_names can be used to assign values to EntryInfo upon initialization. Pieces of information that are deemed mandatory by the class must be filled in before the device is loaded into the database. See Device.mandatory_info to see which attributes are neccesary.

Additional metadata can be given to the device in the form of keywords on initialization, this information is kept in the extraneous attribute, and will be saved in to the database as long as it does not clash with an existing piece of metadata that the client uses to organize devices.

entry_info

list – A list of all the EntryInfo associated with the device

extraneous

dict – Storage for information supplied during initialization that does not correspond to a specific EntryInfo

Raises:
  • EntryError: – If a piece of information supplied at startup is of the incorrect type
  • ContainerError: – If one of the pieces of EntryInfo has a default value of the incorrect type

Example

d = Device(name = 'my_device',         #Alias name for device
           prefix  = 'CXI:DG2:DEV:01', #Base PV for device
           note  = 'Example',          #Piece of arbitrary metadata
          )
active

Whether the device is actively deployed

args

Arguments to pass to device_class

beamline

Section of beamline the device belongs

device_class

Python class that represents the Device

info_names

Names of all EntryInfo for the device

kwargs

Keyword arguments to pass to device_class

macros

The EDM macro string asscociated with the with the device. By using a jinja2 template, this can reference other EntryInfo keywords.

mandatory_info

Mandatory information for the device to be initialized

name

Shorthand name for the device

parent

If the device is a component of another, enter the name

post()

Create a document to be loaded into the happi database

Returns:post – Dictionary of all contained information
Return type:dict
prefix

A base PV for all related records

save()

Overwritten when the device is loaded from the client

screen

The absolute path to the main control screen

show_info(handle=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)

Show the device information in a PrettyTable

Parameters:handle (file-like, optional) – Option to write to a file-like object
stand

Acronym for stand, must be three alphanumeric characters

system

The system the device is involved with, i.e Vacuum, Timing e.t.c

z

Beamline position of the device

Containers

Each of the containers below share the attributes and entries of the generic Device container. This section documents the entries when they either do not exist in the generic device or require further clarification on a case-by-case basis.

happi.containers.GateValve(**kwargs) Standard isolation valves.
happi.containers.Slits(**kwargs) Mechanical devices to control beam profile.
happi.containers.PIM(**kwargs) Beam profile monitors.
happi.containers.PIM(**kwargs) Beam profile monitors.
happi.containers.IPM(**kwargs) Beam intensity monitors.
happi.containers.Attenuator(**kwargs) Beam attenuators, used to get a lower intensity beam downstream to protect the sample or to protect hardware components.
happi.containers.Stopper(**kwargs) Large devices that prevent beam when it could cause damage to hardware.
happi.containers.OffsetMirror(**kwargs) A device that steers beam in the x direction by changing a pitch motor.
happi.containers.PulsePicker(**kwargs) A device that syncs with the timing system to control when beam arrives in the hutch.
happi.containers.LODCM(**kwargs) This LODCM class doesn’t refer to the full LODCM, but rather one of the two crystals.
happi.containers.MovableStand(**kwargs) This class stores information about stands that move, like XPP’s hand-crank that moves SB2 and SB3 from the PINK to XPP lines and back.