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

Functions

uint32_t get_n_frames (daqdataformats::Fragment const &frag)
 Gets number of WIBEthFrames in a fragment.
py::array_t< uint16_t > np_array_adc (daqdataformats::Fragment const &frag)
 Unpacks a Fragment containing WIBEthFrames into a numpy array with the ADC values and dimension (number of WIBEthFrames in the Fragment, 64).
py::array_t< uint16_t > np_array_adc_data (void *data, uint32_t n_frames)
 Unpacks data containing WIBEthFrames into a numpy array with the ADC values and dimension (number of WIBEthFrames, 64) Warning: It doesn't check that n_frames is a sensible value (can read out of bounds).
py::array_t< uint64_t > np_array_timestamp (daqdataformats::Fragment const &frag)
 Unpacks the timestamps in a Fragment containing WIBFrames into a numpy array with dimension (number of WIBEthFrames in the Fragment).
py::array_t< uint64_t > np_array_timestamp_data (void *data, uint32_t n_frames)
 Unpacks data containing WIBEthFrames into a numpy array with the timestamps with dimension (number of WIBEthFrames) Warning: It doesn't check that n_frames is a sensible value (can read out of bounds).

Function Documentation

◆ get_n_frames()

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

Gets number of WIBEthFrames in a fragment.

Definition at line 24 of file WIBEthUnpacker.cpp.

25{
26 return (frag.get_size() - sizeof(daqdataformats::FragmentHeader)) / sizeof(fddetdataformats::WIBEthFrame);
27}
The header for a DUNE Fragment.
struct for accessing raw WIB eth frames, as used in ProtoDUNE-II

◆ np_array_adc()

py::array_t< uint16_t > dunedaq::rawdatautils::wibeth::np_array_adc ( daqdataformats::Fragment const & frag)
extern

Unpacks a Fragment containing WIBEthFrames into a numpy array with the ADC values and dimension (number of WIBEthFrames in the Fragment, 64).

Definition at line 94 of file WIBEthUnpacker.cpp.

95{
96 return np_array_adc_data(frag.get_data(), get_n_frames(frag));
97}
uint32_t get_n_frames(daqdataformats::Fragment const &frag)
Gets number of WIBEthFrames in a fragment.
py::array_t< uint16_t > np_array_adc_data(void *data, uint32_t n_frames)
Unpacks data containing WIBEthFrames into a numpy array with the ADC values and dimension (number of ...

◆ np_array_adc_data()

py::array_t< uint16_t > dunedaq::rawdatautils::wibeth::np_array_adc_data ( void * data,
uint32_t n_frames )
extern

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

Definition at line 35 of file WIBEthUnpacker.cpp.

36{
37
40
41 py::array_t<uint16_t> result(n_ch * n_smpl * n_frames);
42
43 py::buffer_info buf_res = result.request();
44
45 auto ptr_res = static_cast<uint16_t*>(buf_res.ptr);
46
47 for (size_t i = 0; i < n_frames; ++i) {
48
49 auto fr = reinterpret_cast<fddetdataformats::WIBEthFrame*>(static_cast<char*>(data) +
51
52 for (size_t j = 0; j < n_smpl; ++j) {
53 for (size_t k = 0; k < n_ch; ++k) {
54 ptr_res[(n_smpl * n_ch) * i + n_ch * j + k] = fr->get_adc(k, j);
55 }
56 }
57 }
58 result.resize({ n_frames * n_smpl, n_ch });
59
60 return result;
61}
static constexpr int s_time_samples_per_frame

◆ np_array_timestamp()

py::array_t< uint64_t > dunedaq::rawdatautils::wibeth::np_array_timestamp ( daqdataformats::Fragment const & frag)
extern

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

Definition at line 104 of file WIBEthUnpacker.cpp.

105{
106 return np_array_timestamp_data(frag.get_data(), get_n_frames(frag));
107}
py::array_t< uint64_t > np_array_timestamp_data(void *data, uint32_t n_frames)
Unpacks data containing WIBEthFrames into a numpy array with the timestamps with dimension (number of...

◆ np_array_timestamp_data()

py::array_t< uint64_t > dunedaq::rawdatautils::wibeth::np_array_timestamp_data ( void * data,
uint32_t n_frames )
extern

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

Definition at line 69 of file WIBEthUnpacker.cpp.

70{
71
73
74 py::array_t<uint64_t> result(n_smpl * n_frames);
75
76 auto ptr = static_cast<uint64_t*>(result.request().ptr);
77
78 for (size_t i = 0; i < n_frames; ++i) {
79 auto fr = reinterpret_cast<fddetdataformats::WIBEthFrame*>(static_cast<char*>(data) +
81 uint64_t ts_0 = fr->get_timestamp();
82 for (size_t j = 0; j < n_smpl; ++j)
83 ptr[i * n_smpl + j] = ts_0 + 32 * j;
84 }
85
86 return result;
87}
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.