Commit 16156245 authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Reverted Gated base

parent 0d2c5a10
...@@ -26,105 +26,20 @@ namespace edd { ...@@ -26,105 +26,20 @@ namespace edd {
typedef unsigned long long int uint64_cu; typedef unsigned long long int uint64_cu;
static_assert(sizeof(uint64_cu) == sizeof(uint64_t), "Long long int not of 64 bit! This is problematic for CUDA!"); static_assert(sizeof(uint64_cu) == sizeof(uint64_t), "Long long int not of 64 bit! This is problematic for CUDA!");
typedef uint64_t RawVoltageType;
typedef float UnpackedVoltageType;
typedef float2 ChannelisedVoltageType;
typedef float IntegratedPowerType;
//typedef int8_t IntegratedPowerType;
/// Input data and intermediate processing data for one polarization
struct PolarizationData
{
/// Raw ADC Voltage
DoubleDeviceBuffer<RawVoltageType> _raw_voltage;
/// Side channel data
DoubleDeviceBuffer<uint64_t> _sideChannelData;
/// Baseline in gate 0 state
thrust::device_vector<UnpackedVoltageType> _baseLineG0;
/// Baseline in gate 1 state
thrust::device_vector<UnpackedVoltageType> _baseLineG1;
/// Baseline in gate 0 state after update
thrust::device_vector<UnpackedVoltageType> _baseLineG0_update;
/// Baseline in gate 1 state after update
thrust::device_vector<UnpackedVoltageType> _baseLineG1_update;
/// Channelized voltage in gate 0 state
thrust::device_vector<ChannelisedVoltageType> _channelised_voltage_G0;
/// Channelized voltage in gate 1 state
thrust::device_vector<ChannelisedVoltageType> _channelised_voltage_G1;
/// Swaps input buffers
void swap()
{
_raw_voltage.swap();
_sideChannelData.swap();
}
};
// Output data for one gate
struct StokesOutput
{
/// Stokes parameters
DoubleDeviceBuffer<IntegratedPowerType> I;
DoubleDeviceBuffer<IntegratedPowerType> Q;
DoubleDeviceBuffer<IntegratedPowerType> U;
DoubleDeviceBuffer<IntegratedPowerType> V;
/// Number of samples integrated in this output block
DoubleDeviceBuffer<uint64_cu> _noOfBitSets;
/// Reset outptu for new integration
void reset(cudaStream_t &_proc_stream)
{
thrust::fill(thrust::cuda::par.on(_proc_stream),I.a().begin(), I.a().end(), 0.);
thrust::fill(thrust::cuda::par.on(_proc_stream),Q.a().begin(), Q.a().end(), 0.);
thrust::fill(thrust::cuda::par.on(_proc_stream),U.a().begin(), U.a().end(), 0.);
thrust::fill(thrust::cuda::par.on(_proc_stream),V.a().begin(), V.a().end(), 0.);
thrust::fill(thrust::cuda::par.on(_proc_stream), _noOfBitSets.a().begin(), _noOfBitSets.a().end(), 0L);
}
/// Swap output buffers
void swap()
{
I.swap();
Q.swap();
U.swap();
V.swap();
_noOfBitSets.swap();
}
/// Resize all buffers
void resize(size_t size, size_t blocks)
{
I.resize(size * blocks);
Q.resize(size * blocks);
U.resize(size * blocks);
V.resize(size * blocks);
_noOfBitSets.resize(blocks);
}
};
/** /**
@class GatedSpectrometer @class GatedSpectrometer
@brief Split data into two streams and create integrated spectra depending on @brief Split data into two streams and create integrated spectra depending on
bit set in side channel data. bit set in side channel data.
*/ */
template <class HandlerType> class GatedSpectrometer { template <class HandlerType, typename IntegratedPowerType> class GatedSpectrometer {
public: public:
typedef uint64_t RawVoltageType;
typedef float UnpackedVoltageType;
typedef float2 ChannelisedVoltageType;
// typedef float IntegratedPowerType;
//typedef int8_t IntegratedPowerType;
public: public:
/** /**
...@@ -175,10 +90,11 @@ public: ...@@ -175,10 +90,11 @@ public:
bool operator()(RawBytes &block); bool operator()(RawBytes &block);
private: private:
// gate the data and fft data per gate void process(thrust::device_vector<RawVoltageType> const &digitiser_raw,
void gated_fft(PolarizationData &data, thrust::device_vector<uint64_t> const &sideChannelData,
thrust::device_vector<uint64_cu> &_noOfBitSetsIn_G0, thrust::device_vector<IntegratedPowerType> &detected,
thrust::device_vector<uint64_cu> &_noOfBitSetsIn_G1); thrust::device_vector<uint64_cu> &noOfBitSetsIn_G0,
thrust::device_vector<uint64_cu> &noOfBitSetsIn_G1);
private: private:
DadaBufferLayout _dadaBufferLayout; DadaBufferLayout _dadaBufferLayout;
...@@ -199,20 +115,26 @@ private: ...@@ -199,20 +115,26 @@ private:
double _processing_efficiency; double _processing_efficiency;
std::unique_ptr<Unpacker> _unpacker; std::unique_ptr<Unpacker> _unpacker;
std::unique_ptr<DetectorAccumulator<IntegratedPowerType> > _detector;
// Input data and per pol intermediate data // Input data
PolarizationData polarization0, polarization1; DoubleDeviceBuffer<RawVoltageType> _raw_voltage_db;
DoubleDeviceBuffer<uint64_t> _sideChannelData_db;
// Output data // Output data
StokesOutput stokes_G0, stokes_G1; DoubleDeviceBuffer<IntegratedPowerType> _power_db;
DoubleDeviceBuffer<uint64_cu> _noOfBitSetsIn_G0;
DoubleDeviceBuffer<uint64_cu> _noOfBitSetsIn_G1;
DoublePinnedHostBuffer<char> _host_power_db; DoublePinnedHostBuffer<char> _host_power_db;
// Temporary processing block // Intermediate process steps
// ToDo: Use inplace FFT to avoid temporary coltage array
thrust::device_vector<UnpackedVoltageType> _unpacked_voltage_G0; thrust::device_vector<UnpackedVoltageType> _unpacked_voltage_G0;
thrust::device_vector<UnpackedVoltageType> _unpacked_voltage_G1; thrust::device_vector<UnpackedVoltageType> _unpacked_voltage_G1;
thrust::device_vector<ChannelisedVoltageType> _channelised_voltage;
thrust::device_vector<UnpackedVoltageType> _baseLineNG0;
thrust::device_vector<UnpackedVoltageType> _baseLineNG1;
cudaStream_t _h2d_stream; cudaStream_t _h2d_stream;
cudaStream_t _proc_stream; cudaStream_t _proc_stream;
...@@ -220,10 +142,11 @@ private: ...@@ -220,10 +142,11 @@ private:
}; };
/** /**
* @brief Splits the input data depending on a bit set into two arrays. * @brief Splits the input data depending on a bit set into two arrays.
* *
* @detail The resulting gaps are filled with a given baseline value in the other stream. * @detail The resulting gaps are filled with zeros in the other stream.
* *
* @param GO Input data. Data is set to the baseline value if corresponding * @param GO Input data. Data is set to the baseline value if corresponding
* sideChannelData bit at bitpos os set. * sideChannelData bit at bitpos os set.
...@@ -247,63 +170,13 @@ private: ...@@ -247,63 +170,13 @@ private:
__global__ void gating(float *G0, float *G1, const int64_t *sideChannelData, __global__ void gating(float *G0, float *G1, const int64_t *sideChannelData,
size_t N, size_t heapSize, size_t bitpos, size_t N, size_t heapSize, size_t bitpos,
size_t noOfSideChannels, size_t selectedSideChannel, size_t noOfSideChannels, size_t selectedSideChannel,
const float* __restrict__ _baseLineG0, const float baseLineG0,
const float* __restrict__ _baseLineG1, const float baseLineG1,
float* __restrict__ baseLineNG0, float* __restrict__ baseLineNG0,
float* __restrict__ baseLineNG1, float* __restrict__ baseLineNG1,
uint64_cu* stats_G0, uint64_cu* stats_G0,
uint64_cu* stats_G1); uint64_cu* stats_G1);
/**
* @brief calculate stokes IQUV from two complex valuies for each polarization
*/
//__host__ __device__ void stokes_IQUV(const float2 &p1, const float2 &p2, float &I, float &Q, float &U, float &V);
__host__ __device__ void stokes_IQUV(const float2 &p1, const float2 &p2, float &I, float &Q, float &U, float &V)
{
I = fabs(p1.x*p1.x + p1.y * p1.y) + fabs(p2.x*p2.x + p2.y * p2.y);
Q = fabs(p1.x*p1.x + p1.y * p1.y) - fabs(p2.x*p2.x + p2.y * p2.y);
U = 2 * (p1.x*p2.x + p1.y * p2.y);
V = -2 * (p1.y*p2.x - p1.x * p2.y);
}
/**
* @brief calculate stokes IQUV spectra pol1, pol2 are arrays of naccumulate
* complex spectra for individual polarizations
*/
__global__ void stokes_accumulate(float2 const __restrict__ *pol1,
float2 const __restrict__ *pol2, float *I, float* Q, float *U, float*V,
int nchans, int naccumulate)
{
for (size_t i = blockIdx.x * blockDim.x + threadIdx.x; (i < nchans);
i += blockDim.x * gridDim.x)
{
float rI = 0;
float rQ = 0;
float rU = 0;
float rV = 0;
for (int k=0; k < naccumulate; k++)
{
const float2 p1 = pol1[i + k * nchans];
const float2 p2 = pol2[i + k * nchans];
rI += fabs(p1.x * p1.x + p1.y * p1.y) + fabs(p2.x * p2.x + p2.y * p2.y);
rQ += fabs(p1.x * p1.x + p1.y * p1.y) - fabs(p2.x * p2.x + p2.y * p2.y);
rU += 2.f * (p1.x * p2.x + p1.y * p2.y);
rV += -2.f * (p1.y * p2.x - p1.x * p2.y);
}
I[i] += rI;
Q[i] += rQ;
U[i] += rU;
V[i] += rV;
}
}
......
...@@ -25,7 +25,12 @@ const size_t ERROR_UNHANDLED_EXCEPTION = 2; ...@@ -25,7 +25,12 @@ const size_t ERROR_UNHANDLED_EXCEPTION = 2;
template<typename T> template<typename T>
void launchSpectrometer(const effelsberg::edd::DadaBufferLayout &dadaBufferLayout, const std::string &output_type, const std::string &filename, size_t selectedSideChannel, size_t selectedBit, size_t fft_length, size_t naccumulate, unsigned int nbits, float input_level, float output_level) void launchSpectrometer(const effelsberg::edd::DadaBufferLayout
&dadaBufferLayout, const std::string &output_type,
const std::string &filename,
size_t selectedSideChannel, size_t selectedBit,
size_t fft_length, size_t naccumulate, unsigned int nbits,
float input_level, float output_level)
{ {
MultiLog log("DadaBufferLayout"); MultiLog log("DadaBufferLayout");
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "thrust/device_vector.h" #include "thrust/device_vector.h"
#include "thrust/extrema.h" #include "thrust/extrema.h"
namespace {
TEST(GatedSpectrometer, BitManipulationMacros) { TEST(GatedSpectrometer, BitManipulationMacros) {
for (int i = 0; i < 64; i++) { for (int i = 0; i < 64; i++) {
...@@ -22,121 +23,31 @@ TEST(GatedSpectrometer, BitManipulationMacros) { ...@@ -22,121 +23,31 @@ TEST(GatedSpectrometer, BitManipulationMacros) {
} }
} }
//
TEST(GatedSpectrometer, stokes_IQUV) //TEST(GatedSpectrometer, ParameterSanity) {
{ // ::testing::FLAGS_gtest_death_test_style = "threadsafe";
float I,Q,U,V; // psrdada_cpp::NullSink sink;
// No field //
psrdada_cpp::effelsberg::edd::stokes_IQUV((float2){0.0f,0.0f}, (float2){0.0f,0.0f}, I, Q, U, V); // // 8 or 12 bit sampling
EXPECT_FLOAT_EQ(I, 0); // EXPECT_DEATH(psrdada_cpp::effelsberg::edd::GatedSpectrometer<decltype(sink),int8_t > (0, 0, 0, 0, 4096, 0, 0, 0, 0, 0, sink),
EXPECT_FLOAT_EQ(Q, 0); // "_nbits == 8");
EXPECT_FLOAT_EQ(U, 0); // // naccumulate > 0
EXPECT_FLOAT_EQ(V, 0); // EXPECT_DEATH(psrdada_cpp::effelsberg::edd::GatedSpectrometer<decltype(sink),int8_t > (0, 0, 0, 0, 4096, 0, 0, 8, 0, 0, sink),
// "_naccumulate");
// For p1 = Ex, p2 = Ey //
// horizontal polarized // // selected side channel
psrdada_cpp::effelsberg::edd::stokes_IQUV((float2){1.0f,0.0f}, (float2){0.0f,0.0f}, I, Q, U, V); // EXPECT_DEATH(psrdada_cpp::effelsberg::edd::GatedSpectrometer<decltype(sink),int8_t > (0, 1, 2, 0, 4096, 0, 1, 8, 0, 0, sink),
EXPECT_FLOAT_EQ(I, 1); // "nSideChannels");
EXPECT_FLOAT_EQ(Q, 1); //
EXPECT_FLOAT_EQ(U, 0); // // selected bit
EXPECT_FLOAT_EQ(V, 0); // EXPECT_DEATH(psrdada_cpp::effelsberg::edd::GatedSpectrometer<decltype(sink),int8_t > (0, 2, 1, 65, 4096, 0, 1, 8, 0, 0, sink),
// "selectedBit");
// vertical polarized //
psrdada_cpp::effelsberg::edd::stokes_IQUV((float2){0.0f,0.0f}, (float2){1.0f,0.0f}, I, Q, U, V); // // valid construction
EXPECT_FLOAT_EQ(I, 1); // psrdada_cpp::effelsberg::edd::GatedSpectrometer<decltype(sink), int8_t> a(
EXPECT_FLOAT_EQ(Q, -1); // 4096 * 4096, 2, 1, 63, 4096, 1024, 1, 8, 100., 100., sink);
EXPECT_FLOAT_EQ(U, 0); //}
EXPECT_FLOAT_EQ(V, 0); } // namespace
//linear +45 deg.
psrdada_cpp::effelsberg::edd::stokes_IQUV((float2){1.0f/std::sqrt(2),0.0f}, (float2){1.0f/std::sqrt(2),0.0f}, I, Q, U, V);
EXPECT_FLOAT_EQ(I, 1);
EXPECT_FLOAT_EQ(Q, 0);
EXPECT_FLOAT_EQ(U, 1);
EXPECT_FLOAT_EQ(V, 0);
//linear -45 deg.
psrdada_cpp::effelsberg::edd::stokes_IQUV((float2){-1.0f/std::sqrt(2),0.0f}, (float2){1.0f/std::sqrt(2),0.0f}, I, Q, U, V);
EXPECT_FLOAT_EQ(I, 1);
EXPECT_FLOAT_EQ(Q, 0);
EXPECT_FLOAT_EQ(U, -1);
EXPECT_FLOAT_EQ(V, 0);
//left circular
psrdada_cpp::effelsberg::edd::stokes_IQUV((float2){.0f,1.0f/std::sqrt(2)}, (float2){1.0f/std::sqrt(2),.0f}, I, Q, U, V);
EXPECT_FLOAT_EQ(I, 1);
EXPECT_FLOAT_EQ(Q, 0);
EXPECT_FLOAT_EQ(U, 0);
EXPECT_FLOAT_EQ(V, -1);
// right circular
psrdada_cpp::effelsberg::edd::stokes_IQUV((float2){.0f,-1.0f/std::sqrt(2)}, (float2){1.0f/std::sqrt(2),.0f}, I, Q, U, V);
EXPECT_FLOAT_EQ(I, 1);
EXPECT_FLOAT_EQ(Q, 0);
EXPECT_FLOAT_EQ(U, 0);
EXPECT_FLOAT_EQ(V, 1);
}
TEST(GatedSpectrometer, stokes_accumulate)
{
CUDA_ERROR_CHECK(cudaDeviceSynchronize());
size_t nchans = 8 * 1024 * 1024 + 1;
size_t naccumulate = 5;
thrust::device_vector<float2> P0(nchans * naccumulate);
thrust::device_vector<float2> P1(nchans * naccumulate);
thrust::fill(P0.begin(), P0.end(), (float2){0, 0});
thrust::fill(P1.begin(), P1.end(), (float2){0, 0});
thrust::device_vector<float> I(nchans);
thrust::device_vector<float> Q(nchans);
thrust::device_vector<float> U(nchans);
thrust::device_vector<float> V(nchans);
thrust::fill(I.begin(), I.end(), 0);
thrust::fill(Q.begin(), Q.end(), 0);
thrust::fill(U.begin(), U.end(), 0);
thrust::fill(V.begin(), V.end(), 0);
// This channel should be left circular polarized
size_t idx0 = 23;
for (int k = 0; k< naccumulate; k++)
{
size_t idx = idx0 + k * nchans;
P0[idx] = (float2){0.0f, 1.0f/std::sqrt(2)};
P1[idx] = (float2){1.0f/std::sqrt(2),0.0f};
}
psrdada_cpp::effelsberg::edd::stokes_accumulate<<<1024, 1024>>>(
thrust::raw_pointer_cast(P0.data()),
thrust::raw_pointer_cast(P1.data()),
thrust::raw_pointer_cast(I.data()),
thrust::raw_pointer_cast(Q.data()),
thrust::raw_pointer_cast(U.data()),
thrust::raw_pointer_cast(V.data()),
nchans,
naccumulate
);
CUDA_ERROR_CHECK(cudaDeviceSynchronize());
thrust::pair<thrust::device_vector<float>::iterator, thrust::device_vector<float>::iterator> minmax;
minmax = thrust::minmax_element(I.begin(), I.end());
EXPECT_FLOAT_EQ(*minmax.first, 0);
EXPECT_FLOAT_EQ(*minmax.second, naccumulate);
minmax = thrust::minmax_element(Q.begin(), Q.end());
EXPECT_FLOAT_EQ(*minmax.first, 0);
EXPECT_FLOAT_EQ(*minmax.second, 0);
minmax = thrust::minmax_element(U.begin(), U.end());
EXPECT_FLOAT_EQ(*minmax.first, 0);
EXPECT_FLOAT_EQ(*minmax.second, 0);
minmax = thrust::minmax_element(V.begin(), V.end());
EXPECT_FLOAT_EQ(*minmax.first, -1. * naccumulate);
EXPECT_FLOAT_EQ(*minmax.second, 0);
}
TEST(GatedSpectrometer, GatingKernel) TEST(GatedSpectrometer, GatingKernel)
...@@ -152,8 +63,6 @@ TEST(GatedSpectrometer, GatingKernel) ...@@ -152,8 +63,6 @@ TEST(GatedSpectrometer, GatingKernel)
thrust::device_vector<float> baseLineG0(1); thrust::device_vector<float> baseLineG0(1);
thrust::device_vector<float> baseLineG1(1); thrust::device_vector<float> baseLineG1(1);
thrust::device_vector<float> baseLineG0_update(1);
thrust::device_vector<float> baseLineG1_update(1);
thrust::fill(G0.begin(), G0.end(), 42); thrust::fill(G0.begin(), G0.end(), 42);
thrust::fill(G1.begin(), G1.end(), 23); thrust::fill(G1.begin(), G1.end(), 23);
thrust::fill(_sideChannelData.begin(), _sideChannelData.end(), 0); thrust::fill(_sideChannelData.begin(), _sideChannelData.end(), 0);
...@@ -162,22 +71,18 @@ TEST(GatedSpectrometer, GatingKernel) ...@@ -162,22 +71,18 @@ TEST(GatedSpectrometer, GatingKernel)
{ {
thrust::fill(_nG0.begin(), _nG0.end(), 0); thrust::fill(_nG0.begin(), _nG0.end(), 0);
thrust::fill(_nG1.begin(), _nG1.end(), 0); thrust::fill(_nG1.begin(), _nG1.end(), 0);
baseLineG0[0] = -3; baseLineG0[0] = 0.;
baseLineG1[0] = -4; baseLineG1[0] = 0.;
baseLineG0_update[0] = 0;
baseLineG1_update[0] = 0;
const uint64_t *sideCD = const uint64_t *sideCD =
(uint64_t *)(thrust::raw_pointer_cast(_sideChannelData.data())); (uint64_t *)(thrust::raw_pointer_cast(_sideChannelData.data()));
psrdada_cpp::effelsberg::edd::gating<<<1024 , 1024>>>( psrdada_cpp::effelsberg::edd::gating<<<1024 , 1024>>>(
thrust::raw_pointer_cast(G0.data()), thrust::raw_pointer_cast(G0.data()),
thrust::raw_pointer_cast(G1.data()), sideCD, thrust::raw_pointer_cast(G1.data()), sideCD,
G0.size(), blockSize, 0, 1, G0.size(), G0.size(), 0, 1,
0, 0,
-3., -4,
thrust::raw_pointer_cast(baseLineG0.data()), thrust::raw_pointer_cast(baseLineG0.data()),
thrust::raw_pointer_cast(baseLineG1.data()), thrust::raw_pointer_cast(baseLineG1.data()),
thrust::raw_pointer_cast(baseLineG0_update.data()),
thrust::raw_pointer_cast(baseLineG1_update.data()),
thrust::raw_pointer_cast(_nG0.data()), thrust::raw_pointer_cast(_nG0.data()),
thrust::raw_pointer_cast(_nG1.data()) thrust::raw_pointer_cast(_nG1.data())
); );
...@@ -194,31 +99,27 @@ TEST(GatedSpectrometer, GatingKernel) ...@@ -194,31 +99,27 @@ TEST(GatedSpectrometer, GatingKernel)
EXPECT_EQ(_nG0[0], G0.size()); EXPECT_EQ(_nG0[0], G0.size());
EXPECT_EQ(_nG1[0], 0u); EXPECT_EQ(_nG1[0], 0u);
EXPECT_FLOAT_EQ(42.f, baseLineG0_update[0] / (_nG0[0] + 1E-121)); EXPECT_FLOAT_EQ(baseLineG0[0] / (_nG0[0] + 1E-127), 42.f);
EXPECT_FLOAT_EQ(0.f, baseLineG1_update[0] / (_nG1[0] + 1E-121)); EXPECT_FLOAT_EQ(baseLineG1[0] / (_nG1[0] + 1E-127), 0.f);
} }
// everything to G1 // with baseline -5 // everything to G1 // with baseline -5
{ {
thrust::fill(_nG0.begin(), _nG0.end(), 0); thrust::fill(_nG0.begin(), _nG0.end(), 0);
thrust::fill(_nG1.begin(), _nG1.end(), 0); thrust::fill(_nG1.begin(), _nG1.end(), 0);
baseLineG0[0] = 5.; baseLineG0[0] = 0.;
baseLineG1[0] = -2; baseLineG1[0] = 0.;
baseLineG0_update[0] = 0;
baseLineG1_update[0] = 0;
thrust::fill(_sideChannelData.begin(), _sideChannelData.end(), 1L); thrust::fill(_sideChannelData.begin(), _sideChannelData.end(), 1L);
const uint64_t *sideCD = const uint64_t *sideCD =
(uint64_t *)(thrust::raw_pointer_cast(_sideChannelData.data())); (uint64_t *)(thrust::raw_pointer_cast(_sideChannelData.data()));
psrdada_cpp::effelsberg::edd::gating<<<1024, 1024>>>( psrdada_cpp::effelsberg::edd::gating<<<1024, 1024>>>(
thrust::raw_pointer_cast(G0.data()), thrust::raw_pointer_cast(G0.data()),
thrust::raw_pointer_cast(G1.data()), sideCD, thrust::raw_pointer_cast(G1.data()), sideCD,
G0.size(), blockSize, 0, 1, G0.size(), G0.size(), 0, 1,
0, 0,
5., -2.,
thrust::raw_pointer_cast(baseLineG0.data()), thrust::raw_pointer_cast(baseLineG0.data()),
thrust::raw_pointer_cast(baseLineG1.data()), thrust::raw_pointer_cast(baseLineG1.data()),
thrust::raw_pointer_cast(baseLineG0_update.data()),
thrust::raw_pointer_cast(baseLineG1_update.data()),
thrust::raw_pointer_cast(_nG0.data()), thrust::raw_pointer_cast(_nG0.data()),
thrust::raw_pointer_cast(_nG1.data()) thrust::raw_pointer_cast(_nG1.data())
); );
...@@ -233,12 +134,13 @@ TEST(GatedSpectrometer, GatingKernel) ...@@ -233,12 +134,13 @@ TEST(GatedSpectrometer, GatingKernel)
EXPECT_EQ(_nG0[0], 0u); EXPECT_EQ(_nG0[0], 0u);
EXPECT_EQ(_nG1[0], G1.size()); EXPECT_EQ(_nG1[0], G1.size());
EXPECT_FLOAT_EQ(baseLineG0[0] / (_nG0[0] + 1E-127), 0.);
EXPECT_FLOAT_EQ(0.f, baseLineG0_update[0] / (_nG0[0] + 1E-121)); EXPECT_FLOAT_EQ(baseLineG1[0] / (_nG1[0] + 1E-127), 42.);
EXPECT_FLOAT_EQ(42.f, baseLineG1_update[0] / (_nG1[0] + 1E-121));
} }
} }