HDF5 Logger Interface

class larpix.logger.h5_logger.HDF5Logger(filename=None, buffer_length=10000)[source]

The HDF5Logger is logger class for logging packets to an hdf5 file format.

Parameters:
  • filename – filename to store data (optional, default: None)
  • buffer_length – how many data messages to hang on to before flushing buffer to the file (optional, default: 10000)
classmethod encode(data, *args, **kwargs)[source]

Converts data object into a numpy mixed type array as described by data_desc

classmethod encode_packet(packet, timestamp=None, *args, **kwargs)[source]

Converts packets into numpy mixed typ array according to data_desc['raw_packet']

record(data, timestamp=None, *args, **kwargs)[source]

Send the specified data to log file .. note:: buffer is flushed after all data is placed in buffer, this

means that the buffer size will exceed the set value temporarily
Parameters:
  • data – list of data to be written to log
  • timestamp – unix timestamp to be associated with data
is_enabled()[source]

Check if logger is enabled

enable()[source]

Allow the logger to record data

disable()[source]

Stop the logger from recording data without closing file

is_open()[source]

Check if logger is open

open(enable=True)[source]

Open output file if it is not already. If files already exist then data will be appended to the end of arrays.

Parameters:enableTrue if you want to enable the logger after opening (Optional, default=``True``)
close()[source]

Close logger if it is not already

Note

This flushes any data in the buffer before closing

flush()[source]

Flushes any held data to the output file