DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
rawdatautils.unpack.utils.DAPHNEStreamUnpacker Class Reference
Inheritance diagram for rawdatautils.unpack.utils.DAPHNEStreamUnpacker:
[legend]
Collaboration diagram for rawdatautils.unpack.utils.DAPHNEStreamUnpacker:
[legend]

Public Member Functions

 get_n_obj (self, frag)
 
 get_daq_header_version (self, frag)
 
 get_timestamp_first (self, frag)
 
 get_det_data_version (self, frag)
 
 get_det_crate_slot_stream (self, frag)
 
 get_det_header_data (self, frag)
 
 get_det_data_all (self, frag)
 
- Public Member Functions inherited from rawdatautils.unpack.utils.DetectorFragmentUnpacker
 __init__ (self, channel_map=None, ana_data_prescale=1, wvfm_data_prescale=None)
 
 get_daq_header_data (self, frag)
 
 get_det_data (self, frag)
 
- Public Member Functions inherited from rawdatautils.unpack.utils.FragmentUnpacker
 get_trg_data (self, in_data)
 
 get_frh_data (self, frag)
 
 get_all_data (self, in_data)
 
- Public Member Functions inherited from rawdatautils.unpack.utils.Unpacker

Static Public Attributes

 unpacker = rawdatautils.unpack.daphne
 
 frame_obj = fddetdataformats.DAPHNEStreamFrame
 
int SAMPLING_PERIOD = 1
 
int N_CHANNELS_PER_FRAME = 4
 
- Static Public Attributes inherited from rawdatautils.unpack.utils.DetectorFragmentUnpacker
bool is_detector_unpacker = True
 
- Static Public Attributes inherited from rawdatautils.unpack.utils.FragmentUnpacker
bool is_fragment_unpacker = True
 
bool is_detector_unpacker = False
 
bool is_trigger_unpacker = False
 
- Static Public Attributes inherited from rawdatautils.unpack.utils.Unpacker
bool is_fragment_unpacker = False
 
bool is_detector_unpacker = False
 
bool is_trigger_unpacker = False
 

Additional Inherited Members

- Public Attributes inherited from rawdatautils.unpack.utils.DetectorFragmentUnpacker
 ana_data_prescale = None if not ana_data_prescale else int(ana_data_prescale)
 
 wvfm_data_prescale = None if not wvfm_data_prescale else int(wvfm_data_prescale)
 
 channel_map = NullChannelMap
 
- Public Attributes inherited from rawdatautils.unpack.utils.Unpacker
 index = index
 

Detailed Description

Definition at line 722 of file utils.py.

Member Function Documentation

◆ get_daq_header_version()

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.get_daq_header_version ( self,
frag )

Reimplemented from rawdatautils.unpack.utils.DetectorFragmentUnpacker.

Definition at line 733 of file utils.py.

733 def get_daq_header_version(self,frag):
734 return self.frame_obj(frag.get_data()).get_daqheader().version
735

◆ get_det_crate_slot_stream()

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.get_det_crate_slot_stream ( self,
frag )

Reimplemented from rawdatautils.unpack.utils.DetectorFragmentUnpacker.

Definition at line 742 of file utils.py.

742 def get_det_crate_slot_stream(self,frag):
743 dh = self.frame_obj(frag.get_data()).get_daqheader()
744 return dh.det_id, dh.crate_id, dh.slot_id, dh.link_id
745

◆ get_det_data_all()

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.get_det_data_all ( self,
frag )

Reimplemented from rawdatautils.unpack.utils.DetectorFragmentUnpacker.

Definition at line 759 of file utils.py.

759 def get_det_data_all(self,frag):
760 frh = frag.get_header()
761 trigger_number = frh.trigger_number
762
763 get_ana_data = (self.ana_data_prescale is not None and (trigger_number % self.ana_data_prescale)==0)
764 get_wvfm_data = (self.wvfm_data_prescale is not None and (trigger_number % self.wvfm_data_prescale)==0)
765
766 if not (get_ana_data or get_wvfm_data):
767 return None,None
768
769 ana_data = None
770 wvfm_data = None
771
772 adcs = self.unpacker.np_array_adc_stream(frag)
773 dh = self.frame_obj(frag.get_data()).get_header()
774 det, crate, slot, stream = self.get_det_crate_slot_stream(frag)
775 daphne_chans = [ dh.channel_0, dh.channel_1, dh.channel_2, dh.channel_3 ]
776 channels = [ self.channel_map.get_offline_channel_from_det_crate_slot_stream_chan(det, crate, slot, stream, c) for c in daphne_chans ]
777
778 if get_ana_data:
779 adc_mean = np.mean(adcs,axis=0)
780 adc_rms = np.std(adcs,axis=0)
781 adc_max = np.max(adcs,axis=0)
782 adc_min = np.min(adcs,axis=0)
783 adc_median = np.median(adcs,axis=0)
784 ana_data = [ DAPHNEStreamAnalysisData(run=frh.run_number,
785 trigger=frh.trigger_number,
786 sequence=frh.sequence_number,
787 src_id=frh.element_id.id,
788 channel=channels[i_ch],
789 daphne_chan=daphne_chans[i_ch],
790 adc_mean=adc_mean[i_ch],
791 adc_rms=adc_rms[i_ch],
792 adc_max=adc_max[i_ch],
793 adc_min=adc_min[i_ch],
794 adc_median=adc_median[i_ch]) for i_ch in range(self.N_CHANNELS_PER_FRAME) ]
795 if get_wvfm_data:
796 timestamps = self.unpacker.np_array_timestamp_stream(frag)
797 ffts = np.abs(np.fft.rfft(adcs,axis=0))
798 wvfm_data = [ DAPHNEStreamWaveformData(run=frh.run_number,
799 trigger=frh.trigger_number,
800 sequence=frh.sequence_number,
801 src_id=frh.element_id.id,
802 channel=channels[i_ch],
803 daphne_chan=channels[i_ch],
804 adcs=adcs[:,i_ch],
805 timestamps=timestamps,
806 fft_mag=ffts[:,i_ch]) for i_ch in range(self.N_CHANNELS_PER_FRAME) ]
807 return ana_data, wvfm_data
808
809

◆ get_det_data_version()

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.get_det_data_version ( self,
frag )

Reimplemented from rawdatautils.unpack.utils.DetectorFragmentUnpacker.

Definition at line 739 of file utils.py.

739 def get_det_data_version(self,frag):
740 return 0
741

◆ get_det_header_data()

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.get_det_header_data ( self,
frag )

Reimplemented from rawdatautils.unpack.utils.DetectorFragmentUnpacker.

Definition at line 746 of file utils.py.

746 def get_det_header_data(self,frag):
747 frh = frag.get_header()
748 dh = self.frame_obj(frag.get_data()).get_header()
749 ts_diffs_vals, ts_diffs_counts = np.unique(np.diff( np.array(self.unpacker.np_array_timestamp_stream(frag), dtype=np.int64)), return_counts=True)
750 return [ DAPHNEStreamHeaderData(run=frh.run_number,
751 trigger=frh.trigger_number,
752 sequence=frh.sequence_number,
753 src_id=frh.element_id.id,
754 n_channels=self.N_CHANNELS_PER_FRAME,
755 sampling_period=self.SAMPLING_PERIOD,
756 ts_diffs_vals=ts_diffs_vals,
757 ts_diffs_counts=ts_diffs_counts) ]
758

◆ get_n_obj()

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.get_n_obj ( self,
frag )

Reimplemented from rawdatautils.unpack.utils.FragmentUnpacker.

Definition at line 730 of file utils.py.

730 def get_n_obj(self,frag):
731 return self.unpacker.get_n_frames_stream(frag)
732

◆ get_timestamp_first()

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.get_timestamp_first ( self,
frag )

Reimplemented from rawdatautils.unpack.utils.DetectorFragmentUnpacker.

Definition at line 736 of file utils.py.

736 def get_timestamp_first(self,frag):
737 return self.frame_obj(frag.get_data()).get_timestamp()
738

Member Data Documentation

◆ frame_obj

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.frame_obj = fddetdataformats.DAPHNEStreamFrame
static

Definition at line 725 of file utils.py.

◆ N_CHANNELS_PER_FRAME

int rawdatautils.unpack.utils.DAPHNEStreamUnpacker.N_CHANNELS_PER_FRAME = 4
static

Definition at line 728 of file utils.py.

◆ SAMPLING_PERIOD

int rawdatautils.unpack.utils.DAPHNEStreamUnpacker.SAMPLING_PERIOD = 1
static

Definition at line 727 of file utils.py.

◆ unpacker

rawdatautils.unpack.utils.DAPHNEStreamUnpacker.unpacker = rawdatautils.unpack.daphne
static

Definition at line 724 of file utils.py.


The documentation for this class was generated from the following file: