Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
DmTimeDmTest.cpp
1 #include "cheetah/data/test_utils/DmTimeDmTest.h"
2 #include "cheetah/data/test_utils/DmTrialsGeneratorUtil.h"
3 #include "cheetah/data/DmTime.h"
4 #include "cheetah/data/DmTrialsMetadata.h"
5 #include "cheetah/data/DmTrials.h"
6 #include "cheetah/data/TimeSeries.h"
7 #include "panda/Log.h"
8 
9 namespace ska {
10 namespace cheetah {
11 namespace data {
12 namespace test {
13 
14 DmTimeDmTest::DmTimeDmTest()
15  : ::testing::Test()
16 {
17 }
18 
19 DmTimeDmTest::~DmTimeDmTest()
20 {
21 }
22 
23 
24 void DmTimeDmTest::SetUp()
25 {
26 }
27 
28 void DmTimeDmTest::TearDown()
29 {
30 }
31 
32 template <typename Arch>
33 struct CopyTest
34 {
35  static void test(std::size_t nblocks, std::size_t samps_per_block, std::size_t timeseries_length)
36  {
37  typedef DmTrials<Cpu,float> DmTrialsType;
38  typedef typename DmTrialsType::TimeType TimeType;
39  typedef typename DmTrialsType::DmType Dm;
40  auto buffer = DmTime<DmTrialsType>::make_shared();
41  data::TimeSeries<Arch,float> timeseries(timeseries_length);
42  DmTrialsGeneratorUtil<DmTrialsType> trials_generator;
43  for (int block=0; block<nblocks; ++block)
44  {
45  buffer->add(trials_generator.generate(TimeType(0.000064*data::seconds),samps_per_block,3));
46  }
47  ASSERT_EQ(buffer->blocks().size(),nblocks);
48  auto slice = *(buffer->begin(2));
49  auto const& dm = *(slice->begin());
50  auto end = dm.copy_to(timeseries);
51  std::size_t diff = std::distance(timeseries.begin(),end);
52  ASSERT_EQ(diff,std::min(nblocks*samps_per_block,timeseries.size()));
53  }
54 };
55 
56 } // namespace test
57 } // namespace data
58 } // namespace cheetah
59 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35
ConstIterator begin() const
Iterators to device memory.
Definition: Series.cpp:67
Class for time series data.
Definition: TimeSeries.h:47
std::size_t size() const
the size of the series
Definition: Series.cpp:109
A continuous memory container for dispersion measure trials of varying downsamplings.
Definition: DmTrials.h:62
A wrapper class for a list of DmTime instances.