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

Functions

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

Function Documentation

◆ get_n_frames()

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

Gets number of TDEEthFrames in a fragment.

Definition at line 22 of file TDEUnpacker.cpp.

23{
24 return (frag.get_size() - sizeof(daqdataformats::FragmentHeader)) / sizeof(fddetdataformats::TDEEthFrame);
25}
The header for a DUNE Fragment.
Struct for accessing raw TDE eth frames, as used in ProtoDUNE-II.

◆ np_array_adc()

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

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

Definition at line 92 of file TDEUnpacker.cpp.

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

◆ np_array_adc_data()

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

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

Definition at line 33 of file TDEUnpacker.cpp.

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

◆ np_array_timestamp()

py::array_t< long double > dunedaq::rawdatautils::tde::np_array_timestamp ( daqdataformats::Fragment const & frag)

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

Definition at line 102 of file TDEUnpacker.cpp.

103{
104 return np_array_timestamp_data(frag.get_data(), get_n_frames(frag));
105}
py::array_t< long double > np_array_timestamp_data(void *data, uint32_t n_frames)
Unpacks data containing TDEEthFrames into a numpy array with the timestamps with dimension (number of...

◆ np_array_timestamp_data()

py::array_t< long double > dunedaq::rawdatautils::tde::np_array_timestamp_data ( void * data,
uint32_t n_frames )

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

Definition at line 67 of file TDEUnpacker.cpp.

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