Operator

class larpixdaq.operator.Operator(address=None)[source]

The LArPix DAQ Operator module provides the interface into the DAQ core for all DAQ operations.

The Operator class handles all of the needs of an DAQ operator: start/end runs, load/validate configurations, run calibrations, examine data samples and data rates, etc.

Operator methods interact with the DAQ Core to accomplish the desired behavior. The DAQ Core can send multiple responses for a single request - e.g. an immediate acknowledgement of receipt and then the eventual result. The methods implementing these interactions return generator iterators <https://docs.python.org/3/glossary.html#term-generator> rather than values. The way to call these functions usually looks like:

o = Operator()
final_responses = []
for response in o.run_routine('example'):
    print(response)
    # interact with response object within loop
# When the loop ends, the last response received is still saved in
# the response object
final_responses.append(response)

Each method has an optional keyword parameter timeout. If omitted (or if None), then the Operator will wait forever for a response from the DAQ Core. If timeout is provided, then the Operator will yield None as an indication of an error after a maximum wait of 10 times the given timeout, in seconds.

Note

if the timeout limit is reached and the “missing” message arrives later, it will be confused with future results. Operator objects do not maintain useful internal state, so it is acceptable (and recommended!) to initialize a new Operator if the current Operator ran into a timeout issue.

Parameters

address – the TCP address of the DAQ Core. The port will be added automatically. (Optional, if omitted or None, will default to tcp://127.0.0.1.)

cleanup()[source]

Clean up the ZMQ objects used in the Operator.

Only necessary if you are initializing and destroying multiple Operators in one session.

get_boards(timeout=None)[source]

Get a list of board (PCB) names available to load.

load_board(filename, timeout=None)[source]

Load the particular board (PCB) into LArPix Control as a Controller configuration.

Parameters

filename – the file to load, e.g. 'controller/pcb-1_chip_info.json'

retrieve_pixel_layout(timeout=None)[source]

Fetch the currently-loaded pixel geometry layout.

load_pixel_layout(pcb_id, timeout=None)[source]

Load the specified pixel layout into the online monitor.

Parameters

pcb_id – the PCB specifier to request from larpix.configs.load, e.g. pcb-3.

write_configuration(chip, timeout=None)[source]

Send the configuration values from software onto the ASIC.

Parameters

chip – the chip key as a string

read_configuration(chip, timeout=None)[source]

Read the configuration values from the ASIC.

Parameters

chip – the chip key as a string

validate_configuration(chip, timeout=None)[source]

Read the configuration from the specified LArPix ASIC and return (True/False, {name: (actual, stored)}).

Parameters

chip – the chip key as a string

retrieve_configuration(chip, timeout=None)[source]

Return a dict of the current configuration stored in software for the given chipid.

Parameters

chip – the chip key as a string

Returns

a dict mapping the configuration item name (could be multiple or part of a register) to the value.

send_configuration(updates, timeout=None)[source]

Send the given configuration updates to the LArPix control software.

Parameters

updates – a dict mapping chip keys to a dict readable by the LArPix Control Configuration.from_dict. Note that omitted registers will not be updated (but also will not be deleted or reset).

list_routines()[source]

Return a list of routines/calibrations.

load_routines(location)[source]

Load any routines saved at location into the LArPix Producer.

Parameters

location – the directory containing the routines files to load.

Returns

the new list of routines (same as subsequently calling list_routines)

run_routine(name, *args, timeout=None)[source]

Run the given routine and return the routine’s output.

prepare_physics_run(timeout=None)[source]

Enter the “READY” DAQ state so that all DAQ components are ready to begin the physics run.

begin_physics_run(timeout=None)[source]

Begin taking physics data, activate online data monitoring and analytics, and store the data in offline storage.

end_physics_run(timeout=None)[source]

Stop taking physics data, deactivate online data monitoring and analytics, and finalize the offline storage.