Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
TdasTester.cpp
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "cheetah/tdas/test_utils/TdasTester.h"
25 #include "cheetah/data/DmTrialsMetadata.h"
26 #include "cheetah/data/FrequencySeries.h"
27 #include "cheetah/data/Ccl.h"
28 #include "cheetah/data/Units.h"
29 #include "cheetah/utils/Architectures.h"
30 #include "cheetah/data/ComplexTypeTraits.h"
31 #include "cheetah/data/test_utils/DmTimeTest.h"
32 
33 #include <iostream>
34 #include <memory>
35 
36 namespace ska {
37 namespace cheetah {
38 namespace tdas {
39 namespace test {
40 
41 template<typename ArchitectureTag, typename ArchitectureCapability, typename T>
42 TdasTesterTraits<ArchitectureTag,ArchitectureCapability, T>::TdasTesterTraits()
43  : _api(_config)
44 {
45 }
46 
47 template<typename ArchitectureTag, typename ArchitectureCapability, typename T>
48 tdas::Tdas<T>& TdasTesterTraits<ArchitectureTag,ArchitectureCapability, T>::api()
49 {
50  return _api;
51 }
52 
53 template<typename ArchitectureTag, typename ArchitectureCapability, typename T>
54 tdas::Config& TdasTesterTraits<ArchitectureTag,ArchitectureCapability, T>::config()
55 {
56  return _config;
57 }
58 
59 template <typename DeviceType, typename Arch, typename T>
60 struct ExecTest
61 {
62  inline static void test(DeviceType& device, tdas::Tdas<T>& api)
63  {
64  typedef typename utils::ModifiedJulianClock::time_point TimePoint;
65  typedef typename data::SecondsType<double> Seconds;
66  typedef typename tdas::DmTrialsType::DmType Dm;
67  std::size_t number_of_blocks = 10L;
68  auto buffer = tdas::DmTimeType::make_shared();
69  typename utils::ModifiedJulianClock::time_point epoch(utils::julian_day(40587.0));
70  for (std::size_t block=0; block<number_of_blocks; ++block)
71  {
72  auto metadata = data::DmTrialsMetadata::make_shared(Seconds(0.0001*data::seconds),1<<14);
73  metadata->emplace_back(Dm(0.0*data::parsecs_per_cube_cm),1);
74  metadata->emplace_back(Dm(10.0*data::parsecs_per_cube_cm),2);
75  metadata->emplace_back(Dm(20.0*data::parsecs_per_cube_cm),4);
76  auto trials = tdas::DmTrialsType::make_shared(metadata,epoch);
77  buffer->add(trials);
78  }
79  auto it = buffer->begin(2);
80  auto slice = *it;
81  std::shared_ptr<data::Ccl> candidate_list = api.process(device,*slice);
82  }
83 };
84 
85 template <typename TestTraits>
88 {
89 }
90 
91 template <typename TestTraits>
93 {
94 }
95 
96 template<typename TestTraits>
98 {
99 }
100 
101 template<typename TestTraits>
103 {
104 }
105 
106 ALGORITHM_TYPED_TEST_P(TdasTester, test_exec)
107 {
108  TypeParam traits;
109  auto& config = traits.config();
110  auto& api = traits.api();
112 }
113 
114 // each test defined by ALGORITHM_TYPED_TEST_P must be added to the
115 // test register (each one as an element of the comma seperated list)
116 REGISTER_TYPED_TEST_CASE_P(TdasTester, test_exec);
117 
118 } // namespace test
119 } // namespace tdas
120 } // namespace cheetah
121 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35
std::shared_ptr< data::Ccl > process(panda::PoolResource< Arch > &resource, DmTimeSliceType const &data, Args &&... args)
Process a DmTimeSlice in search of significant periodic signals over a range of acceleration values...
Definition: Tdas.cpp:41