Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
AccelerationSearch.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_ACCELERATIONSEARCH_H
25 #define SKA_CHEETAH_PIPELINE_ACCELERATIONSEARCH_H
26 #include "cheetah/pipeline/SinglePulseFactory.h"
27 #include "cheetah/pipeline/Dedispersion.h"
28 #include "cheetah/pipeline/AccelerationSearchAlgoConfig.h"
29 #include "cheetah/pipeline/detail/FldoHandler.h"
30 #include "cheetah/psbc/Psbc.h"
31 #include "cheetah/sift/Sift.h"
32 #include "cheetah/fldo/Fldo.h"
33 #include <panda/DataSwitch.h>
34 #include <memory>
35 
36 namespace ska {
37 namespace cheetah {
38 namespace pipeline {
39 
85 template<typename NumericalT>
87 {
91  template<typename DmHandlerT>
92  static inline
94  , BeamConfig<NumericalT> const& beam_config
95  , DmHandlerT dm_handler
96  )
97  {
98  SinglePulseFactory<NumericalT> sp_factory(cheetah_config);
99  return sp_factory.create(beam_config, dm_handler);
100  }
101 };
102 
103 template<typename NumericalT, typename AccelerationSearchTraitsT>
104 class AccelerationSearch : public PipelineHandler<NumericalT>
105 {
106  private:
109  typedef typename panda::is_pointer_wrapper<typename Dedispersion<NumericalT>::DmTrialType>::type DmTrialsType;
110 
111  public:
112  typedef AccelerationSearchTraitsT Traits;
113  typedef NumericalT value_type;
114 
115  public:
117  virtual ~AccelerationSearch();
118 
122  void operator()(TimeFrequencyType&) override;
123 
124  public:
132  template<typename T>
133  using has_create_fldo_handler_t = decltype(std::declval<T&>().create_fldo_handler(std::declval<DataExport<value_type>&>()
134  , std::declval<CheetahConfig<NumericalT> const&>()
135  , std::declval<BeamConfig<NumericalT> const&>()));
136  private:
138  friend FldoHandler;
139 
140  struct SiftHandler {
141  public:
142  SiftHandler(AccelerationSearch&);
143  void operator()(std::shared_ptr<data::Scl>) const;
144 
145  private:
146  AccelerationSearch& _pipeline;
147  };
148 
150  typedef typename std::remove_pointer<decltype(std::declval<AccelerationSearchTraitsT>().create_acceleration_search_algo(
151  std::declval<AccelerationSearchAlgoConfig const&>()
152  , std::declval<SiftType&>()
153  )
154  )>::type AccelerationSearchAlgoType;
155  public:
159  Dedispersion<NumericalT> const& dedispersion_pipeline() const;
160 
164  typename FldoHandler::FldoHandlerType const& fldo_handler() const;
165 
169  AccelerationSearchAlgoType const& acceleration_search_pipeline() const;
170 
171  private:
172  CheetahConfig<NumericalT> const& _config;
173  BeamConfig<NumericalT> const& _beam_config;
174  FldoHandler _fldo_handler;
176  SiftHandler _sift_handler;
177  SiftType _sift;
178  std::unique_ptr<AccelerationSearchAlgoType> _acceleration_search;
180  ska::panda::DataSwitch<DmTrialsType> _dm_switch; // need to be able to switch pipelines on/off at runtime
181 
182  std::unique_ptr<Dedispersion<NumericalT>> _dedisperser;
183  std::vector<std::shared_ptr<TimeFrequencyType>> _tf_data;
184 
185 };
186 
187 } // namespace pipeline
188 } // namespace cheetah
189 } // namespace ska
190 #include "detail/AccelerationSearch.cpp"
191 
192 #endif // SKA_CHEETAH_PIPELINE_ACCELERATIONSEARCH_H
decltype(std::declval< T & >().create_fldo_handler(std::declval< DataExport< value_type > & >(), std::declval< CheetahConfig< NumericalT > const & >(), std::declval< BeamConfig< NumericalT > const & >())) has_create_fldo_handler_t
template for testing if type T has a create_fldo_handler function
The FLDO primary API.
Definition: Fldo.h:54
The acceleration search pipeline.
Generate a suitable SinglePulse implementaion bases on the configuration parameters.
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 Cheetah Pipeline Handlers.
Definition: Pipeline.h:37
Base class for dedispersion pipeline handlers.
Definition: Dedispersion.h:46
static Dedispersion< NumericalT > * create_dedispersion_pipeline(CheetahConfig< NumericalT > const &cheetah_config, BeamConfig< NumericalT > const &beam_config, DmHandlerT dm_handler)
Default dedispersion is the cheetsh SinglePulse pipeline.