13#include <pybind11/numpy.h>
15namespace py = pybind11;
35 py::array_t<uint16_t> result(n_ch * n_smpl * n_frames);
37 py::buffer_info buf_res = result.request();
39 auto ptr_res =
static_cast<uint16_t*
>(buf_res.ptr);
41 for (
size_t i=0; i<n_frames; ++i) {
47 for (
size_t j=0; j<n_smpl; ++j){
48 for (
size_t k=0; k<n_ch; ++k){
49 ptr_res[(n_smpl*n_ch) * i + n_ch*j + k] = fr->get_adc(k, j);
53 result.resize({n_frames*n_smpl, n_ch});
67 py::array_t<long double> result(n_smpl*n_frames);
69 auto ptr =
static_cast<long double*
>(result.request().ptr);
71 for (
size_t i=0; i<n_frames; ++i) {
76 for(
size_t j=0; j<n_smpl; ++j )
77 ptr[i*n_smpl+j] = ts_0+31.25*j;
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 (numb...
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 (numbe...
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...
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 ...