DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::rawdatautils::daphne Namespace Reference

Functions

uint32_t get_n_frames (daqdataformats::Fragment const &frag)
 Gets number of DAPHNEFrames in a fragment

 
uint32_t get_n_frames_stream (daqdataformats::Fragment const &frag)
 Gets number of DAPHNEStreamFrames in a fragment

 
py::array_t< uint8_t > np_array_channels_stream_data (void *data, int nframes)
 Unpacks channel numbers for DAPHNEStreamFrames into a numpy array with dimensions (nframes, s_channels_per_frame)

 
py::array_t< uint8_t > np_array_channels_data (void *data, int nframes)
 Unpacks channel numbers for DAPHNEFrames into a numpy array with dimensions (nframes)

 
py::array_t< uint8_t > np_array_channels (daqdataformats::Fragment &frag)
 Unpacks channel numbers for Fragment that contains DAPHNEFrames into a numpy array with dimensions

 
py::array_t< uint8_t > np_array_channels_stream (daqdataformats::Fragment &frag)
 Unpacks channel numbers for Fragment that contains DAPHNEStreamFrames into a numpy array with dimensions

 
py::array_t< uint16_t > np_array_adc_data (void *data, int nframes)
 Unpacks data containing DAPHNEFrames into a numpy array with the ADC values and dimension (number of DAPHNEFrames, channels_per_daphne) Warning: It doesn't check that nframes is a sensible value (can read out of bounds)
 
py::array_t< uint16_t > np_array_adc_stream_data (void *data, int nframes)
 Unpacks data containing DAPHNEStreamFrames into a numpy array with the ADC
values and dimension (number of DAPHNEStreamFrames * adcs_per_channel (64), channels_per_frame (4))
Warning: It doesn't check that nframes is a sensible value (can read out of bounds)

 
py::array_t< uint64_t > np_array_timestamp_data (void *data, int nframes)
 Unpacks data containing DAPHNEFrames into a numpy array with the timestamps with dimension (number of DAPHNEFrames) Warning: It doesn't check that nframes is a sensible value (can read out of bounds)
 
py::array_t< uint64_t > np_array_timestamp_stream_data (void *data, int nframes)
 Unpacks data containing DAPHNEStreamFrames into a numpy array with the
timestamps with dimension (number of DAPHNEStreamFrames)
Warning: It doesn't check that nframes is a sensible value (can read out of bounds)

 
py::array_t< uint16_t > np_array_adc (daqdataformats::Fragment &frag)
 Unpacks a Fragment containing DAPHNEFrames into a numpy array with the ADC values and dimension (number of DAPHNEFrames in the Fragment, 320)
 
py::array_t< uint16_t > np_array_adc_stream (daqdataformats::Fragment &frag)
 Unpacks a Fragment containing DAPHNEStreamFrames into a numpy array with the
ADC values and dimension (number of DAPHNEStreamFrames in the Fragment, 4)

 
py::array_t< uint64_t > np_array_timestamp (daqdataformats::Fragment &frag)
 Unpacks the timestamps in a Fragment containing WIBFrames into a numpy array with dimension (number of DAPHNEFrames in the Fragment)
 
py::array_t< uint64_t > np_array_timestamp_stream (daqdataformats::Fragment &frag)
 Unpacks the timestamps in a Fragment containing DAPHNEStreamFrames into a numpy
array with dimension (number of DAPHNEStreamFrames in the Fragment)

 

Function Documentation

◆ get_n_frames()

uint32_t dunedaq::rawdatautils::daphne::get_n_frames ( daqdataformats::Fragment const & frag)

Gets number of DAPHNEFrames in a fragment

Definition at line 22 of file DAPHNEUnpacker.cpp.

◆ get_n_frames_stream()

uint32_t dunedaq::rawdatautils::daphne::get_n_frames_stream ( daqdataformats::Fragment const & frag)

Gets number of DAPHNEStreamFrames in a fragment

Definition at line 29 of file DAPHNEUnpacker.cpp.

◆ np_array_adc()

py::array_t< uint16_t > dunedaq::rawdatautils::daphne::np_array_adc ( daqdataformats::Fragment & frag)

Unpacks a Fragment containing DAPHNEFrames into a numpy array with the ADC values and dimension (number of DAPHNEFrames in the Fragment, 320)

Definition at line 184 of file DAPHNEUnpacker.cpp.

184 {
186}
void * get_data() const
Get a pointer to the data payload in the Fragmnet.
Definition Fragment.hpp:254
fragment_size_t get_size() const
Get the total size of the Fragment.
Definition Fragment.hpp:242
py::array_t< uint16_t > np_array_adc_data(void *data, int nframes)
Unpacks data containing DAPHNEFrames into a numpy array with the ADC values and dimension (number of ...

◆ np_array_adc_data()

py::array_t< uint16_t > dunedaq::rawdatautils::daphne::np_array_adc_data ( void * data,
int nframes )

Unpacks data containing DAPHNEFrames into a numpy array with the ADC values and dimension (number of DAPHNEFrames, channels_per_daphne) Warning: It doesn't check that nframes is a sensible value (can read out of bounds)

Definition at line 95 of file DAPHNEUnpacker.cpp.

95 {
96
97 const auto adcs_per_channel = fddetdataformats::DAPHNEFrame::s_num_adcs;
98
99 py::array_t<uint16_t> ret(nframes * adcs_per_channel);
100 auto ptr = static_cast<uint16_t*>(ret.request().ptr);
101 for (size_t i=0; i<(size_t)nframes; ++i) {
102 auto fr = reinterpret_cast<fddetdataformats::DAPHNEFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::DAPHNEFrame));
103 //auto fr = reinterpret_cast<fddetdataformats::DAPHNEFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::DAPHNEFrame));
104 for (size_t j=0; j<adcs_per_channel; ++j) {
105 ptr[i*adcs_per_channel + j] = fr->get_adc(j);
106 }
107 //for (size_t j=0; j<channels_per_daphne; ++j)
108
109 }
110 ret.resize({nframes, adcs_per_channel});
111
112 return ret;
113}

◆ np_array_adc_stream()

py::array_t< uint16_t > dunedaq::rawdatautils::daphne::np_array_adc_stream ( daqdataformats::Fragment & frag)

Unpacks a Fragment containing DAPHNEStreamFrames into a numpy array with the
ADC values and dimension (number of DAPHNEStreamFrames in the Fragment, 4)

Definition at line 192 of file DAPHNEUnpacker.cpp.

192 {
194}
py::array_t< uint16_t > np_array_adc_stream_data(void *data, int nframes)
Unpacks data containing DAPHNEStreamFrames into a numpy array with the ADC values and dimension (nu...

◆ np_array_adc_stream_data()

py::array_t< uint16_t > dunedaq::rawdatautils::daphne::np_array_adc_stream_data ( void * data,
int nframes )

Unpacks data containing DAPHNEStreamFrames into a numpy array with the ADC
values and dimension (number of DAPHNEStreamFrames * adcs_per_channel (64), channels_per_frame (4))
Warning: It doesn't check that nframes is a sensible value (can read out of bounds)

Definition at line 120 of file DAPHNEUnpacker.cpp.

120 {
121
122 const auto channels_per_daphne = fddetdataformats::DAPHNEStreamFrame::s_channels_per_frame;
123 const auto adcs_per_channel = fddetdataformats::DAPHNEStreamFrame::s_adcs_per_channel;
124
125
126 py::array_t<uint16_t> ret(channels_per_daphne * nframes * adcs_per_channel);
127 auto ptr = static_cast<uint16_t*>(ret.request().ptr);
128 for (size_t i=0; i<(size_t)nframes; ++i) {
129 auto fr = reinterpret_cast<fddetdataformats::DAPHNEStreamFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::DAPHNEStreamFrame));
130 for (size_t j=0; j<adcs_per_channel; ++j)
131 for (size_t k=0; k<channels_per_daphne; ++k)
132 ptr[channels_per_daphne * (adcs_per_channel * i + j) + k] = fr->get_adc(j,k);
133 }
134 ret.resize({nframes*adcs_per_channel, channels_per_daphne});
135
136 return ret;
137}
uint16_t get_adc(uint i, uint chn) const
Get the i ADC value of chn in the frame.

◆ np_array_channels()

py::array_t< uint8_t > dunedaq::rawdatautils::daphne::np_array_channels ( daqdataformats::Fragment & frag)

Unpacks channel numbers for Fragment that contains DAPHNEFrames into a numpy array with dimensions

Definition at line 78 of file DAPHNEUnpacker.cpp.

78 {
80}
py::array_t< uint8_t > np_array_channels_data(void *data, int nframes)
Unpacks channel numbers for DAPHNEFrames into a numpy array with dimensions (nframes)

◆ np_array_channels_data()

py::array_t< uint8_t > dunedaq::rawdatautils::daphne::np_array_channels_data ( void * data,
int nframes )

Unpacks channel numbers for DAPHNEFrames into a numpy array with dimensions (nframes)

Definition at line 63 of file DAPHNEUnpacker.cpp.

63 {
64
65 py::array_t<uint8_t> channels(nframes);
66 auto ptr = static_cast<uint8_t*>(channels.request().ptr);
67
68 for (size_t i=0; i<(size_t)nframes; ++i) {
69 auto fr = reinterpret_cast<fddetdataformats::DAPHNEFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::DAPHNEFrame));
70 ptr[i] = fr->get_channel();
71 }
72
73 return channels;
74}

◆ np_array_channels_stream()

py::array_t< uint8_t > dunedaq::rawdatautils::daphne::np_array_channels_stream ( daqdataformats::Fragment & frag)

Unpacks channel numbers for Fragment that contains DAPHNEStreamFrames into a numpy array with dimensions

Definition at line 85 of file DAPHNEUnpacker.cpp.

85 {
87}
py::array_t< uint8_t > np_array_channels_stream_data(void *data, int nframes)
Unpacks channel numbers for DAPHNEStreamFrames into a numpy array with dimensions (nframes,...

◆ np_array_channels_stream_data()

py::array_t< uint8_t > dunedaq::rawdatautils::daphne::np_array_channels_stream_data ( void * data,
int nframes )

Unpacks channel numbers for DAPHNEStreamFrames into a numpy array with dimensions (nframes, s_channels_per_frame)

Definition at line 39 of file DAPHNEUnpacker.cpp.

39 {
40
41 const auto channels_per_daphne = fddetdataformats::DAPHNEStreamFrame::s_channels_per_frame;
42 py::array_t<uint8_t> channels(channels_per_daphne * nframes);
43 auto ptr = static_cast<uint8_t*>(channels.request().ptr);
44
45 for (size_t i=0; i<(size_t)nframes; ++i) {
46 auto fr = reinterpret_cast<fddetdataformats::DAPHNEStreamFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::DAPHNEStreamFrame));
47
48 ptr[i*channels_per_daphne + 0] = fr->get_channel0();
49 ptr[i*channels_per_daphne + 1] = fr->get_channel1();
50 ptr[i*channels_per_daphne + 2] = fr->get_channel2();
51 ptr[i*channels_per_daphne + 3] = fr->get_channel3();
52
53 }
54 channels.resize({nframes, channels_per_daphne});
55
56 return channels;
57}
uint8_t get_channel0() const
Get the channel 0 from the DAPHNE Stream frame header

◆ np_array_timestamp()

py::array_t< uint64_t > dunedaq::rawdatautils::daphne::np_array_timestamp ( daqdataformats::Fragment & frag)

Unpacks the timestamps in a Fragment containing WIBFrames into a numpy array with dimension (number of DAPHNEFrames in the Fragment)

Definition at line 201 of file DAPHNEUnpacker.cpp.

201 {
203}
py::array_t< uint64_t > np_array_timestamp_data(void *data, int nframes)
Unpacks data containing DAPHNEFrames into a numpy array with the timestamps with dimension (number of...

◆ np_array_timestamp_data()

py::array_t< uint64_t > dunedaq::rawdatautils::daphne::np_array_timestamp_data ( void * data,
int nframes )

Unpacks data containing DAPHNEFrames into a numpy array with the timestamps with dimension (number of DAPHNEFrames) Warning: It doesn't check that nframes is a sensible value (can read out of bounds)

Definition at line 145 of file DAPHNEUnpacker.cpp.

145 {
146
147 py::array_t<uint64_t> ret(nframes);
148 auto ptr = static_cast<uint64_t*>(ret.request().ptr);
149 for (size_t i=0; i<(size_t)nframes; ++i) {
150 auto fr = reinterpret_cast<fddetdataformats::DAPHNEFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::DAPHNEFrame));
151 ptr[i] = fr->get_timestamp();
152 }
153
154 return ret;
155}
uint64_t get_timestamp() const
Get the 64-bit timestamp of the frame.

◆ np_array_timestamp_stream()

py::array_t< uint64_t > dunedaq::rawdatautils::daphne::np_array_timestamp_stream ( daqdataformats::Fragment & frag)

Unpacks the timestamps in a Fragment containing DAPHNEStreamFrames into a numpy
array with dimension (number of DAPHNEStreamFrames in the Fragment)

Definition at line 209 of file DAPHNEUnpacker.cpp.

209 {
211}
py::array_t< uint64_t > np_array_timestamp_stream_data(void *data, int nframes)
Unpacks data containing DAPHNEStreamFrames into a numpy array with the timestamps with dimension (n...

◆ np_array_timestamp_stream_data()

py::array_t< uint64_t > dunedaq::rawdatautils::daphne::np_array_timestamp_stream_data ( void * data,
int nframes )

Unpacks data containing DAPHNEStreamFrames into a numpy array with the
timestamps with dimension (number of DAPHNEStreamFrames)
Warning: It doesn't check that nframes is a sensible value (can read out of bounds)

Definition at line 162 of file DAPHNEUnpacker.cpp.

162 {
163
164 const auto adcs_per_channel = fddetdataformats::DAPHNEStreamFrame::s_adcs_per_channel;
165 const size_t ticks_per_adc = 1;
166
167 py::array_t<uint64_t> ret(nframes*adcs_per_channel);
168
169 auto ptr = static_cast<uint64_t*>(ret.request().ptr);
170 for (size_t i=0; i<(size_t)nframes; ++i) {
171 auto fr = reinterpret_cast<fddetdataformats::DAPHNEStreamFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::DAPHNEStreamFrame));
172 for (size_t j=0; j<adcs_per_channel; ++j)
173 ptr[i*adcs_per_channel+j] = fr->get_timestamp()+j*ticks_per_adc;
174 }
175
176 return ret;
177}