Producer

$ python -m larpixdaq.producer --help
usage: producer.py [-h] [--core CORE] [--log-address LOG_ADDRESS] --io-config
                   IO_CONFIG [IO_CONFIG ...] [-d]
                   address

Launch the data interface between LArPix and the xylem DAQ pipeline

positional arguments:
  address               The address to publish data to including port number

optional arguments:
  -h, --help            show this help message and exit
  --core CORE           The address of the DAQ Core, not including port number
  --log-address LOG_ADDRESS
                        Address to connect to global log, including port
                        number
  --io-config IO_CONFIG [IO_CONFIG ...]
                        <IO class> [constructor arguments], e.g. "ZMQ_IO
                        io/default.json"
  -d, --debug           Enter debug (verbose) mode
class larpixdaq.producer.LArPixProducer(output_address, core_address, log_address, io_config)[source]

The entry point of LArPix data into the xylem DAQ pipeline.

On initialization, the LArPixProducer object will be connected to the DAQ Core, loaded up with the 'pcb-1' Controller configuration, connected to the appropriate IO instance, and set up with a larpix.logger.Logger subclass instance that logs all data into xylem (disabled on initialization, accessible at self.board.logger).

The producer is the component with direct contact into the LArPix environment. As such, the producer receives data from the data board and sends it into the DAQ chain. It also sends configuration commands to the LArPix ASICs and runs custom DAQ routines such as threshold scans and calibrations.

Implementation-wise, this all happens via a larpix-control Controller object (not to be confused with the DAQ Controller).

Custom routines can be implemented using the larpixdaq.routines package. Custom Routines are managed in a Routine object, in which you should store the routine name, function handle/reference, and list of parameters. (TODO!!! allow for documentation for custom routines.) Routines can access the DAQ functionality via their arguments controller, send_data, send_info. They can also accept additional arguments. Routines must return a tuple of (controller, result) where result is the output of the routine (e.g. a list of thresholds, or even simply the string “success”) which must be JSON-serializable.

Variables
  • producer – the xylem Producer object used to send data

  • board – the larpix.larpix.Controller instance used to gather data

  • current_boardname – the short name of the layout/configuration used for the Controller object, e.g. 'pcb-1'.

  • state – the DAQ State of the xylem Producer component

Parameters
  • output_address – the full TCP address (including port number) that data will be published to

  • core_address – the full TCP address (including port number) of the DAQ Core

  • log_address – the full TCP address (including port number) of the DAQ Log

  • io_config – a list with the IO class name in position 0, and, optionally, the positional arguments to pass to the IO class constructor. E.g. ['FakeIO'] or ['MultiZMQ_IO', 'io/default.json'].

write_config(key, registers_str='')[source]

Send the given configuration to the board.

Parameters
  • key – the chip key to send the configuration to

  • registers_str – the configuration registers to send, specified as an int, a list of ints, or a string specifying a literal int or list of ints (e.g. '[1, 2, 10]').

read_config(key, registers_str='')[source]

Read configurations from the board.

Parameters
  • key – the chip key to send the configuration to

  • registers_str – the configuration registers to send, specified as an int, a list of ints, or a string specifying a literal int or list of ints (e.g. '[1, 2, 10]').

validate_config(key)[source]

Read configurations from the board and compare to those stored in software, returning True if they’re equal.

Parameters

key – the chip key whose configuration will be validated

retrieve_config(key)[source]

Return the current configuration stored in software for the given chip.

Parameters

key – the chip key whose configuration will be retrieved

send_config(updates)[source]

Apply the given updates to the software configuration.

Parameters

updates – a dict of configuration register updates compatible with larpix.larpix.Config.from_dict.

get_boards()[source]

List the available boards and chip keys, and the current board name.

load_board(filename)[source]

Load the board (Controller) configuration located at the given filename.

Parameters

filename – the file name to load. If using a pre-installed configuration, the file name must begin with the standard 'controller/' directory prefix.

static list_routines()[source]

List the available routines.

static load_routines(location)[source]

Load the routines saved at location.

Parameters

location – the directory to load routines from

run_routine(name, *args)[source]

Run the given routine.

Parameters
  • name – the name of the routine to run

  • args – all subsequent arguments are passed in order to the routine as parameters

static sleep(time_in_sec)[source]

Sleep and return success.

run()[source]

Event loop of checking for DAQ commands, checking for new data, and repeating.

If the DAQ State is RUN, the data logger will be enabled so that newly-arrived data will be sent to the xylem pipeline. In all other DAQ States, the data logger will be disabled so data will not be send down the pipeline.

If the IO object on self.board is a FakeIO object, fake data will be generated to mimic data arriving from the LArPix board.