daq2lh5.llama package

Submodules

daq2lh5.llama.llama_base module

General utilities for llamaDAQ data decoding

daq2lh5.llama.llama_base.join_fadcid_chid(fadcid, chid)
Return type:

int

daq2lh5.llama.llama_event_decoder module

class daq2lh5.llama.llama_event_decoder.LLAMAEventDecoder(*args, **kwargs)

Bases: DataDecoder

Decode llamaDAQ SIS3316 digitizer event data.

__add_accum1till6(decoded_values_fch)
__add_accum7and8(decoded_values_fch)
__add_energy(decoded_values_fch)
__add_maw(decoded_values_fch)
__add_waveform(decoded_values_fch, is_avg, max_samples, dt)

Helper function to add waveform.

Averaged samples are available from the 125 MHz (16 bit) variatnt of the SIS3316 and can be stored independently of raw samples. I use waveform for raw samples (dt from clock itself) and waveform_presummed from averaged samples (dt from clock * avg number).

GERDA used to have the low-frequency (waveform) & the high-frequency (aux waveform); here: LF = waveform_presummed & HF = waveform_windowed.

decode_packet(packet, evt_rbkd, packet_id, fadc_channel_id)

Decode packet.

Decodes a single packet, which is a single SIS3316 event, as specified in the Struck manual. A single packet corresponds to a single event and channel, and has a unique timestamp. packets of different channel groups can vary in size!

Return type:

bool

get_decoded_values(key=None)

Get decoded values (optionally for a given key, typically a channel).

Notes

Must overload for your decoder if it has key-specific decoded values. Must also implement key = None returns a “default” decoded_values. Otherwise, just returns self.decoded_values, which should be defined in the constructor.

Return type:

dict[str, Any]

get_key_lists()

Get list of keys.

Return a list of lists of keys available for this decoder. Each inner list are the fadc_channel_id’s which share the exact same settings (trace lengths, avg mode, …), so they can end up in the same buffer.

Return type:

list[list[int | str]]

set_channel_configs(channel_configs)

Receive channel configurations from llama_streamer after header was parsed.

Adapt self.decoded_values dict based on read configuration.

set_global_configs(global_configs)
daq2lh5.llama.llama_event_decoder.check_dict_spec_equal(d1, d2, specs)
Return type:

bool

daq2lh5.llama.llama_header_decoder module

class daq2lh5.llama.llama_header_decoder.LLAMAHeaderDecoder(*args, **kwargs)

Bases: DataDecoder

Decode llamaDAQ header data.

Includes the file header as well as all available (“open”) channel configurations.

__decode_channel_configs(f_in)

Reads the metadata.

Reads the metadata from the beginning of the file (the “channel configuration” part, directly after the file header). Creates a dictionary of the metadata for each FADC/channel combination, which is returned. Returns number of bytes read.

FADC-ID and channel-ID are combined into a single id for flattening: (fadcid << 4) + chid.

Return type:

int

decode_header(f_in, f_in_name)
Return type:

Struct

get_channel_configs()
Return type:

dict[int, dict[str, Any]]

get_global_configs()
Return type:

dict[str, Any]

static magic_bytes()
Return type:

int

make_lgdo(key=None, size=None)

Make an LGDO for this DataDecoder to fill.

This default version of this function allocates a Table using the decoded_values for key. If a different type of LGDO object is required for this decoder, overload this function.

Parameters:
  • key (int | None) – used to initialize the LGDO for a particular key (e.g. to have different trace lengths for different channels of a piece of hardware). Leave as None if such specialization is not necessary.

  • size (int | None) – the size to be allocated for the LGDO, if applicable.

Returns:

data_obj – the newly allocated LGDO.

Return type:

Struct

daq2lh5.llama.llama_header_decoder.parse_filename_for_timestamp(f_in_name)

take a filename; return the unixtime parsed from the filename; 0 if impossible.

Return type:

float

daq2lh5.llama.llama_streamer module

class daq2lh5.llama.llama_streamer.LLAMAStreamer

Bases: DataStreamer

Decode SIS3316 data acquired using llamaDAQ.

__read_bytes()

return bytes if read successful or None if EOF. int is the fch_id (needs to be fetched to obtain the size of the event)

Return type:

tuple[bytes | None, int]

_abc_impl = <_abc._abc_data object>
close_stream()

Close this data stream.

Note

Needs to be overloaded.

get_decoder_list()

Returns a list of decoder objects for this data stream.

Notes

Needs to be overloaded. Gets called during open_stream().

Return type:

list[DataDecoder]

open_stream(llama_filename, rb_lib=None, buffer_size=8192, chunk_mode='any_full', out_stream='')

Initialize the LLAMA data stream.

Refer to the documentation for data_streamer.DataStreamer.open_stream() for a description of the parameters.

Return type:

list[RawBuffer]

read_packet()

Reads a single packet’s worth of data in to the RawBufferLibrary.

Returns:

still_has_data – returns True while there is still data to read.

Return type:

bool