backend

Implements all the reading and translation of facility specific data streams into a unified format that can be used by the analysis package.

class backend.Worker(config_file, port)[source]

Bases: object

Coordinates data reading, translation and analysis.

This is the main class of the backend of Hummingbird. It uses a light source dependent translator to read and translate the data into a common format. It then runs whatever analysis algorithms are specified in the user provided configuration file.

Args:
config_file (str): The configuration file to load.
conf = None
ctrlcevent(whatSignal, stack)[source]
event_loop()[source]

The event loop.

While state['running'] is True, it will get events from the translator and process them as fast as possible.

load_conf()[source]

Load or reload the configuration file.

raise_interruption(signum, stack)[source]
start()[source]

Start the event loop.

state = None
class backend.EventTranslator(event, source_translator)[source]

Bases: object

Provides the interface between the analysis code and the various translators.

The evt argument of onEvent(), which must be defined in every configuration file is actually an EventTranslator.

event_id()[source]

Returns an id which should be unique for each shot and increase monotonically

event_id2()[source]

Returns an alternaive id

keys()[source]

Returns the translated keys available

native_keys()[source]

Returns the keys, with facility specific names, available

class backend.Record(name, data, unit=None)[source]

Bases: object

Generic storage class for a name/data pair extracted from an event

backend.add_record(values, group, name, data, unit=None)[source]

Convenience function to add a new Record to an existing Records dictionary.

backend.lcls

Translates between LCLS events and Hummingbird ones

class backend.lcls.EPICSdict(epics)[source]

Bases: object

Provides a dict-like interface to EPICS parameters.

Translated all the parameters is too slow too slow. Instead parameters are only translated as they are needed, when they are accessed, using this class.

keys()[source]

Returns available EPICS names

len()[source]

Returns the length of the dictionary

class backend.lcls.LCLSTranslator(state)[source]

Bases: object

Translate between LCLS events and Hummingbird ones

event_id(evt)[source]

Returns an id which should be unique for each shot and increase monotonically

event_id2(evt)[source]

Returns the LCLS time, a 64-bit integer as an alterative ID

event_keys(evt)[source]

Returns the translated keys available

event_native_keys(evt)[source]

Returns the native keys available

next_event()[source]

Grabs the next event and returns the translated version

translate(evt, key)[source]

Returns a dict of Records that match a given humminbird key

translate_core(evt, key)[source]

Returns a dict of Records that matchs a core humminbird key.

Core keys include all except: parameters, any psana create key, any native key.

backend.lcls.add_cmdline_args(parser)[source]