ZeroMQ IO Interface

class larpix.io.zmq_io.ZMQ_IO(address)[source]

The ZMQ_IO object interfaces with the Bern LArPix v2 module using the ZeroMQ communications protocol.

This object handles the required communications, and also has extra methods for additional functionality, including system reset, packet count, clock frequency, and more.

send(packets)[source]

Function for sending larpix packet objects

Parameters:packetslist of larpix Packet objects to send via IO
Returns:None
start_listening()[source]

Function for starting read communications on IO

Returns:None
stop_listening()[source]

Function for halting read communications on IO

Returns:None
classmethod is_valid_chip_key(key)[source]

Valid chip keys must be strings formatted as: '<io_chain>-<chip_id>'

classmethod parse_chip_key(key)[source]

Decodes a chip key into 'chip_id' and io_chain

Returns:dict with keys ('chip_id', 'io_chain')
classmethod generate_chip_key(**kwargs)[source]

Generates a valid ZMQ_IO chip key

Parameters:
  • chip_idint corresponding to internal chip id
  • io_chainint corresponding to daisy chain number
classmethod decode(msgs)[source]

Convert a list ZMQ messages into packets

classmethod encode(packets)[source]

Encode a list of packets into ZMQ messages

empty_queue()[source]

Read and remove the current items in the internal queue. The details of the queue implementation is left up to the specific IO class. Generally returns all packets that have been read since last call to start_listening or empty_queue, whichever was most recent.

Returns:tuple of (list of Packet objects, raw bytestream)
reset()[source]

Send a reset pulse to the LArPix ASICs.

set_clock(freq_khz)[source]

Set the LArPix CLK2X freqency (in kHz).

set_testpulse_freq(divisor)[source]

Set the testpulse frequency, computed by dividing the CLK2X frequency by divisor.

get_packet_count(io_channel)[source]

Get the number of packets received, as determined by the number of UART “start” bits processed.

ping()[source]

Send a ping to the system and return True if the first two bytes of the response are b’OK’.