pygama.raw.fc package#
This subpackage overloads decoding utilities defined in pygama.raw to
read files produced by the FlashCam acquisition system.
Submodules#
pygama.raw.fc.fc_config_decoder module#
- class pygama.raw.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
>>> import fcutils >>> from pygama.raw.fc.fc_config_decoder import FCConfigDecoder >>> fc = fcutils.fcio('file.fcio') >>> decoder = FCConfigDecoder() >>> config = decoder.decode_config(fc) >>> type(config) pygama.lgdo.struct.Struct
- buffer_is_full(rb: RawBuffer) bool#
Returns whether the buffer is too full to read in another packet.
- Return type:
- make_lgdo(key: Optional[int] = None, size: Optional[int] = None) Struct#
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:
pygama.raw.fc.fc_event_decoder module#
- class pygama.raw.fc.fc_event_decoder.FCEventDecoder(*args, **kwargs)#
Bases:
DataDecoderDecode FlashCam digitizer event data.
- decode_packet(fcio: fcio, evt_rbkd: pygama.lgdo.table.Table | dict[int, pygama.lgdo.table.Table], packet_id: int) bool#
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 (pygama.lgdo.table.Table | dict[int, pygama.lgdo.table.Table]) – A single table for reading out all data, or a dictionary of tables keyed by channel number.
packet_id (int) – The index of the packet in the fcio stream. Incremented by
FCStreamer.
- Returns:
n_bytes – (estimated) number of bytes in the packet that was just decoded.
- Return type:
- get_decoded_values(channel: Optional[int] = None) dict[str, dict[str, Any]]#
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_list() range#
Overload with list of keys for this decoder, e.g.
return range(n_channels). The default version works for decoders with single / no keys.- Return type:
- set_file_config(fc_config: Struct) None#
Access
FCIOConfigmembers once when each file is opened.- Parameters:
fc_config (Struct) – extracted via
decode_config().
pygama.raw.fc.fc_status_decoder module#
pygama.raw.fc.fc_streamer module#
- class pygama.raw.fc.fc_streamer.FCStreamer#
Bases:
DataStreamerDecode FlashCam data, using the
fcutilspackage to handle file access, and the FlashCam data decoders to save the results and write to output.- _abc_impl = <_abc._abc_data object>#
- get_decoder_list() list[pygama.raw.data_decoder.DataDecoder]#
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_filename: str, rb_lib: Optional[RawBufferLibrary] = None, buffer_size: int = 8192, chunk_mode: str = 'any_full', out_stream: str = '') list[pygama.raw.raw_buffer.RawBuffer]#
Initialize the FlashCam data stream.
Refer to the documentation for
raw.data_streamer.DataStreamer.open_stream()for a description of the parameters.- Returns:
header_data – a list of length 1 containing the raw buffer holding the
FCConfigtable.- Return type:
- read_packet() bool#
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: