Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
AccelerationSearchTest.h
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 #ifndef SKA_CHEETAH_PIPELINE_TEST_ACCELERATIONSEARCHPIPELINE_H
25 #define SKA_CHEETAH_PIPELINE_TEST_ACCELERATIONSEARCHPIPELINE_H
26 
27 #include <gtest/gtest.h>
28 #include "cheetah/data/DmTime.h"
29 #include "cheetah/data/DmTrials.h"
30 #include "cheetah/pipeline/Dedispersion.h"
31 #include "cheetah/pipeline/AccelerationSearch.h"
32 
33 namespace ska {
34 namespace cheetah {
35 namespace pipeline {
36 namespace test {
37 
38 template<typename NumericalT>
40 {
41  // traits that implements ONLY the create_acceleration_search_algo
42  public:
45 
46  template<typename SiftHandlerT>
48  {
49  AccelerationTestHandler(SiftHandlerT& handler);
50 
51  void operator()(std::shared_ptr<DmTimeType> const&);
52 
53  bool wait_sift_handler_called() const;
54 
55  private:
56  SiftHandlerT& _handler;
57  mutable std::condition_variable _acceleration_wait;
58  mutable std::mutex _acceleration_data_mutex;
59  std::vector<std::shared_ptr<DmTimeType>> _received_data;
60  bool _sift_handler_called = false;
61 
62  };
63 
64  public:
65  template<typename SiftHandlerT>
66  static AccelerationTestHandler<SiftHandlerT>* create_acceleration_search_algo(AccelerationSearchAlgoConfig const&
67  , SiftHandlerT&);
68 };
69 
70 template<typename NumericalT>
72 {
74  typedef typename BaseT::DmTrialsType DmTrialsType;
75  typedef typename BaseT::DmTimeType DmTimeType;
76 
77  public:
78  struct TestHandler : pipeline::Dedispersion<NumericalT>
79  {
81  typedef typename Dedispersion<NumericalT>::DmHandler DedispersionHandler;
82 
83  TestHandler(CheetahConfig<NumericalT> const&, BeamConfig<NumericalT> const&, DedispersionHandler);
84 
85  void operator()(typename BaseT::TimeFrequencyType&) override;
86 
87  bool wait_dedispersion_handler_called() const;
88 
89  private:
90  mutable std::condition_variable _dedispersion_wait;
91  mutable std::mutex _dedispersion_data_mutex;
92  std::vector<std::shared_ptr<typename BaseT::TimeFrequencyType>> _received_tf_data;
93  bool _dm_handler_called = false;
94 
95  };
96 
98  {
99  void operator()(std::shared_ptr<data::Ocld> const&);
100 
101  bool wait_fldo_handler_called() const;
102 
103  private:
104  mutable std::condition_variable _fldo_wait;
105  mutable std::mutex _fldo_data_mutex;
106  std::vector<std::shared_ptr<data::Ocld>> _candidate_data;
107  bool _fldo_handler_called = false;
108  };
109 
110  static
112 
113 
114  template<typename DmHandlerT>
115  static
116  TestHandler* create_dedispersion_pipeline(CheetahConfig<NumericalT> const&, BeamConfig<NumericalT> const&, DmHandlerT);
117 
118 };
119 
120 class AccelerationSearchTest : public ::testing::Test
121 {
122  protected:
123  void SetUp() override;
124  void TearDown() override;
125 
126  public:
129 
130  private:
131 };
132 
133 } // namespace test
134 } // namespace pipeline
135 } // namespace cheetah
136 } // namespace ska
137 
138 #endif //SKA_CHEETAH_PIPELINE_TEST_ACCELERATIONSEARCHPIPELINE_H
Configuration parameters for the available acceleration searches.
Some limits and constants for FLDO.
Definition: Brdz.h:35
Parse configuration parameters for a single beam in the pipeline instance of cheetah.
Definition: BeamConfig.h:48
Base class for dedispersion pipeline handlers.
Definition: Dedispersion.h:46
A continuous memory container for dispersion measure trials of varying downsamplings.
Definition: DmTrials.h:62
A wrapper class for a list of DmTime instances.