daq2lh5.fc package¶
This subpackage overloads decoding utilities defined in pygama.raw to
read files produced by the FlashCam acquisition system.
Submodules¶
daq2lh5.fc.fc_config_decoder module¶
- class daq2lh5.fc.fc_config_decoder.FCConfigDecoder(*args, **kwargs)¶
Bases:
DataDecoderDecode FlashCam config data.
Note
Derives from
DataDecoderin anticipation of possible future functionality. Currently the base class interface is not used.Example
>>> from fcio import fcio_open >>> from daq2lh5.fc.config_decoder import FCConfigDecoder >>> fc = fcio_open('file.fcio') >>> decoder = FCConfigDecoder() >>> config = decoder.decode_config(fc) >>> type(config) lgdo.types.struct.Struct
- 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 = Nonereturns a “default” decoded_values. Otherwise, just returnsself.decoded_values, which should be defined in the constructor.
- get_key_lists()¶
Return a list of lists of keys available for this decoder. Each list must contain keys that can share a buffer, i.e. decoded_values is exactly the same (including e.g. waveform length) for all keys in the list. Overload with lists of keys for this decoder, e.g.
return [range(n_channels)]. The default version works for decoders with single / no keys.
daq2lh5.fc.fc_event_decoder module¶
- class daq2lh5.fc.fc_event_decoder.FCEventDecoder(*args, **kwargs)¶
Bases:
DataDecoderDecode FlashCam digitizer event data.
- decode_packet(fcio, evt_rbkd, packet_id)¶
Access
FCIOEventmembers for each event in the DAQ file.- Parameters:
fcio (FCIO) – The interface to the
fciodata. Enters this function after a call tofcio.get_record()so that data for packet_id ready to be read out.evt_rbkd (Table | dict[int, Table]) – A single table for reading out all data, or a dictionary of tables keyed by rawid.
packet_id (int) – The index of the packet in the fcio stream. Incremented by
FCStreamer.
- Returns:
any_full – TODO
- Return type:
- 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 = Nonereturns a “default” decoded_values. Otherwise, just returnsself.decoded_values, which should be defined in the constructor.
- get_key_lists()¶
Return a list of lists of keys available for this decoder. Each list must contain keys that can share a buffer, i.e. decoded_values is exactly the same (including e.g. waveform length) for all keys in the list. Overload with lists of keys for this decoder, e.g.
return [range(n_channels)]. The default version works for decoders with single / no keys.
- get_max_rows_in_packet()¶
Returns the maximum number of rows that could be read out in a packet.
1 by default, overload as necessary to avoid writing past the ends of buffers.
- Return type:
- set_fcio_stream(fcio_stream)¶
Access
FCIOConfigmembers once when each file is opened.- Parameters:
fc_config – extracted via
decode_config().
daq2lh5.fc.fc_eventheader_decoder module¶
- class daq2lh5.fc.fc_eventheader_decoder.FCEventHeaderDecoder(*args, **kwargs)¶
Bases:
DataDecoder- 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 = Nonereturns a “default” decoded_values. Otherwise, just returnsself.decoded_values, which should be defined in the constructor.
- get_key_lists()¶
Return a list of lists of keys available for this decoder. Each list must contain keys that can share a buffer, i.e. decoded_values is exactly the same (including e.g. waveform length) for all keys in the list. Overload with lists of keys for this decoder, e.g.
return [range(n_channels)]. The default version works for decoders with single / no keys.
- get_max_rows_in_packet()¶
Returns the maximum number of rows that could be read out in a packet.
1 by default, overload as necessary to avoid writing past the ends of buffers.
- Return type:
- set_fcio_stream(fcio_stream)¶
Access
FCIOConfigmembers once when each file is opened.- Parameters:
fc_config – extracted via
decode_config().
daq2lh5.fc.fc_fsp_decoder module¶
- class daq2lh5.fc.fc_fsp_decoder.FSPConfigDecoder(*args, **kwargs)¶
Bases:
DataDecoder- 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 = Nonereturns a “default” decoded_values. Otherwise, just returnsself.decoded_values, which should be defined in the constructor.
- get_key_lists()¶
Return a list of lists of keys available for this decoder. Each list must contain keys that can share a buffer, i.e. decoded_values is exactly the same (including e.g. waveform length) for all keys in the list. Overload with lists of keys for this decoder, e.g.
return [range(n_channels)]. The default version works for decoders with single / no keys.
- make_lgdo(key=None, size=None)¶
Make an LGDO for this
DataDecoderto fill.This default version of this function allocates a
Tableusing the decoded_values for key. If a different type of LGDO object is required for this decoder, overload this function.- Parameters:
- Returns:
data_obj – the newly allocated LGDO.
- Return type:
- set_fcio_stream(fcio_stream)¶
- class daq2lh5.fc.fc_fsp_decoder.FSPEventDecoder(*args, **kwargs)¶
Bases:
DataDecoder- 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 = Nonereturns a “default” decoded_values. Otherwise, just returnsself.decoded_values, which should be defined in the constructor.
- get_key_lists()¶
Return a list of lists of keys available for this decoder. Each list must contain keys that can share a buffer, i.e. decoded_values is exactly the same (including e.g. waveform length) for all keys in the list. Overload with lists of keys for this decoder, e.g.
return [range(n_channels)]. The default version works for decoders with single / no keys.
- set_fcio_stream(fcio_stream)¶
- class daq2lh5.fc.fc_fsp_decoder.FSPStatusDecoder(*args, **kwargs)¶
Bases:
DataDecoder- 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 = Nonereturns a “default” decoded_values. Otherwise, just returnsself.decoded_values, which should be defined in the constructor.
- get_key_lists()¶
Return a list of lists of keys available for this decoder. Each list must contain keys that can share a buffer, i.e. decoded_values is exactly the same (including e.g. waveform length) for all keys in the list. Overload with lists of keys for this decoder, e.g.
return [range(n_channels)]. The default version works for decoders with single / no keys.
- set_fcio_stream(fcio_stream)¶
daq2lh5.fc.fc_status_decoder module¶
- class daq2lh5.fc.fc_status_decoder.FCStatusDecoder(*args, **kwargs)¶
Bases:
DataDecoderDecode FlashCam digitizer status data.
- decode_packet(fcio, status_rbkd, packet_id)¶
Access
FCIOStatusmembers for each status packet in the DAQ file.- Parameters:
fcio (FCIO) – The interface to the
fciodata. Enters this function after a call tofcio.get_record()so that data for packet_id ready to be read out.status_rbkd (Table | dict[int, Table]) – A single table for reading out all data, or a dictionary of tables keyed by card number.
packet_id (int) – The index of the packet in the fcio stream. Incremented by
FCStreamer.
- Returns:
any_full – TODO
- Return type:
- decoded_values¶
Default FlashCam status decoded values.
Warning
This configuration can be dynamically modified by the decoder at runtime.
- 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 = Nonereturns a “default” decoded_values. Otherwise, just returnsself.decoded_values, which should be defined in the constructor.
- get_key_lists()¶
Return a list of lists of keys available for this decoder. Each list must contain keys that can share a buffer, i.e. decoded_values is exactly the same (including e.g. waveform length) for all keys in the list. Overload with lists of keys for this decoder, e.g.
return [range(n_channels)]. The default version works for decoders with single / no keys.
- get_max_rows_in_packet()¶
Returns the maximum number of rows that could be read out in a packet.
1 by default, overload as necessary to avoid writing past the ends of buffers.
- Return type:
- set_fcio_stream(fcio_stream)¶
Access
FCIOConfigmembers once when each file is opened.- Parameters:
fcio_stream (FCIO) – extracted via
decode_config().
- daq2lh5.fc.fc_status_decoder.get_key(streamid, reqid)¶
daq2lh5.fc.fc_streamer module¶
- class daq2lh5.fc.fc_streamer.FCStreamer¶
Bases:
DataStreamerDecode FlashCam data, using the
fciopackage to handle file access, and the FlashCam data decoders to save the results and write to output.- _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:
- open_stream(fcio_peer, rb_lib=None, buffer_size=8192, chunk_mode='any_full', out_stream='')¶
Initialize the FlashCam data stream.
Refer to the documentation for
data_streamer.DataStreamer.open_stream()for a description of the parameters.
- read_packet()¶
Reads a single packet’s worth of data in to the
RawBufferLibrary.Needs to be overloaded. Gets called by
read_chunk()Needs to updateself.any_fullif any buffers would possibly over-fill on the next read. Needs to updateself.n_bytes_readtoo.- Returns:
still_has_data – returns True while there is still data to read.
- Return type: