DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
WIBUnpacker.cpp
Go to the documentation of this file.
1
11
12#include <cstdint>
13#include <pybind11/numpy.h>
14
15namespace py = pybind11;
17
23py::array_t<uint16_t> np_array_adc_data(void* data, int nframes){
24 py::array_t<uint16_t> ret(256 * nframes);
25 auto ptr = static_cast<uint16_t*>(ret.request().ptr);
26 for (size_t i=0; i<(size_t)nframes; ++i) {
27 auto fr = reinterpret_cast<fddetdataformats::WIBFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::WIBFrame));
28 for (size_t j=0; j<256; ++j)
29 ptr[256 * i + j] = fr->get_channel(j);
30 }
31 ret.resize({nframes, 256});
32
33 return ret;
34}
35
41py::array_t<uint64_t> np_array_timestamp_data(void* data, int nframes){
42 py::array_t<uint64_t> ret(nframes);
43 auto ptr = static_cast<uint64_t*>(ret.request().ptr);
44 for (size_t i=0; i<(size_t)nframes; ++i) {
45 auto fr = reinterpret_cast<fddetdataformats::WIBFrame*>(static_cast<char*>(data) + i * sizeof(fddetdataformats::WIBFrame));
46 ptr[i] = fr->get_timestamp();
47 }
48
49 return ret;
50}
51
56py::array_t<uint16_t> np_array_adc(daqdataformats::Fragment& frag){
58}
59
67
68
69} // namespace dunedaq::rawdatautils::wib // NOLINT
C++ Representation of a DUNE Fragment, wrapping the flat byte array that is the Fragment's "actual" f...
Definition Fragment.hpp:38
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
uint16_t get_channel(const uint8_t block_num, const uint8_t adc, const uint8_t ch) const
Definition WIBFrame.hpp:381
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 o...
py::array_t< uint16_t > np_array_adc(daqdataformats::Fragment &frag)
Unpacks a Fragment containing WIBFrames into a numpy array with the ADC values and dimension (number ...
py::array_t< uint64_t > np_array_timestamp_data(void *data, int nframes)
Unpacks data containing WIBFrames into a numpy array with the timestamps with dimension (number of WI...
py::array_t< uint16_t > np_array_adc_data(void *data, int nframes)
Unpacks data containing WIBFrames into a numpy array with the ADC values and dimension (number of WIB...
The header for a DUNE Fragment.