7 DaqChunk::DaqChunk(
const uint32_t& _perchannel,
const uint32_t& _nchannels,
const uint32_t& _area)
9 , nchannels(_nchannels)
10 , perchannel(_perchannel)
11 , data(_perchannel*_nchannels, 0)
12 , lastmapped(_nchannels,
std::begin(data)) {
13 assert(
area < SCOPE_NAREAS);
25 uint32_t halffactor = _factor>>2;
26 auto pixelend = std::begin(
data);
29 for (
auto it = std::begin(
data), downit = std::begin(
data); it != std::end(
data) ; ++downit ) {
31 pixelend = it + _factor;
33 for ( ; it != pixelend ; ++it)
34 acc = acc + static_cast<uint32_t>(*it);
35 *downit =
static_cast<uint16_t
>(acc / _factor) + ((acc%_factor)>halffactor?1u:0u);
48 std::transform(std::begin(
data), std::end(
data), std::begin(
data), [&_factor](uint16_t& elem) {
49 return round2ui16(_factor * static_cast<double>(elem)); } );
std::vector< iterator > lastmapped
Iterators to positions that was last mapped.
uint32_t perchannel
Number of samples per channel.
const uint32_t area
Area of the DaqChunk.
std::vector< uint16_t > data
The data vector.
This is the include file for standard system include files, or project specific include files that ar...
DaqChunk(const uint32_t &_perchannel, const uint32_t &_nchannels, const uint32_t &_area)
virtual void Downsample(const uint32_t &_factor)
Downsamples by averaging _factor samples.
virtual void Scale(const double &_factor)
Multiplies every sample by _factor.
Various helper functions and classes for Scope.
const uint32_t nchannels
Number of channels in that area/DaqChunk.