Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
AccelerationSearch.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/pipeline/CheetahConfig.h"
25 #include "panda/Log.h"
26 #include <iostream>
27 
28 namespace ska {
29 namespace cheetah {
30 namespace pipeline {
31 
32 template<typename NumericalT, typename AccelerationSearchTraitsT>
33 AccelerationSearch<NumericalT, AccelerationSearchTraitsT>::SiftHandler::SiftHandler(AccelerationSearch& pipeline)
34  : _pipeline(pipeline)
35 {
36 }
37 
38 template<typename NumericalT, typename AccelerationSearchTraitsT>
39 void AccelerationSearch<NumericalT, AccelerationSearchTraitsT>::SiftHandler::operator()(std::shared_ptr<data::Scl> scl) const
40 {
41  _pipeline._fldo(_pipeline._tf_data, *scl);
42 }
43 
44 template<typename NumericalT, typename AccelerationSearchTraitsT>
45 AccelerationSearch<NumericalT, AccelerationSearchTraitsT>::AccelerationSearch(CheetahConfig<NumericalT> const& config, BeamConfig<NumericalT> const& beam_config)
46  : BaseT(config, beam_config)
47  , _config(config)
48  , _beam_config(beam_config)
49  , _fldo_handler(*this)
50  , _fldo(config.fldo_config(), _fldo_handler)
51  , _sift_handler(*this)
52  , _sift(config.sift_config(), _sift_handler)
53  , _acceleration_search(AccelerationSearchTraitsT::create_acceleration_search_algo(config.acceleration_search_config(), _sift))
54  , _psbc(config.psbc_config(), *_acceleration_search)
55  , _dm_switch(config.switch_config())
56  , _dedisperser(AccelerationSearchTraitsT::create_dedispersion_pipeline(config, beam_config,
57  [this](std::shared_ptr<DmTrialsType> data) {
58  _dm_switch.send(panda::ChannelId("acc_search"), data);
59  }
60  ))
61 {
62  _dm_switch.template add<DmTrialsType>(panda::ChannelId("acc_search"),
63  [this](DmTrialsType& data) {
64  // acc search pipeline
65  // call the psbc operator()
66  _psbc(data.shared_from_this());
67  });
68 }
69 
70 template<typename NumericalT, typename AccelerationSearchTraitsT>
71 AccelerationSearch<NumericalT, AccelerationSearchTraitsT>::~AccelerationSearch()
72 {
73  _config.pool_manager().wait();
74  PANDA_LOG_DEBUG << "AccelerationSearch<NumericalT, typename AccelerationSearchTraitsT>::~AccelerationSearch()";
75 }
76 
77 template<typename NumericalT, typename AccelerationSearchTraitsT>
79 {
80  _tf_data.push_back(chunk.shared_from_this());
81  (*_dedisperser)(chunk);
82 }
83 
84 template<typename NumericalT, typename AccelerationSearchTraitsT>
85 typename AccelerationSearch<NumericalT, AccelerationSearchTraitsT>::AccelerationSearchAlgoType const& AccelerationSearch<NumericalT, AccelerationSearchTraitsT>::acceleration_search_pipeline() const
86 {
87  return *_acceleration_search;
88 }
89 
90 template<typename NumericalT, typename AccelerationSearchTraitsT>
92 {
93  return *_dedisperser;
94 }
95 
96 template<typename NumericalT, typename AccelerationSearchTraitsT>
98 {
99  return _fldo_handler.handler();
100 }
101 
102 } // namespace pipeline
103 } // namespace cheetah
104 } // namespace ska
void operator()(TimeFrequencyType &) override
called whenever data is available for processing
AccelerationSearchAlgoType const & acceleration_search_pipeline() const
access the acceleration_search pipeline object
Some limits and constants for FLDO.
Definition: Brdz.h:35
FldoHandler::FldoHandlerType const & fldo_handler() const
access the fldo handler object
Base class for dedispersion pipeline handlers.
Definition: Dedispersion.h:46
Dedispersion< NumericalT > const & dedispersion_pipeline() const
access to the dedispersion pipeline object