Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
SpCclSigProc.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/exporters/SpCclSigProc.h"
25 
26 namespace ska {
27 namespace cheetah {
28 namespace exporters {
29 
30 template<typename NumericalRep>
31 SpCclSigProc<NumericalRep>::SpCclSigProc(SpCclSigProcConfig const& config)
32  : _config(config)
33  , _writer(config)
34 {
35 }
36 
37 template<typename NumericalRep>
38 SpCclSigProc<NumericalRep>::SpCclSigProc(SpCclSigProcConfig& config)
39  :_config(config)
40  ,_writer(config)
41 {
42 }
43 
44 template<typename NumericalRep>
45 SpCclSigProc<NumericalRep>::~SpCclSigProc()
46 {
47 }
48 
49 template<typename NumericalRep>
50 std::vector<typename SpCclSigProc<NumericalRep>::TimePointType> SpCclSigProc<NumericalRep>::start_times()
51 {
52  return _start_times;
53 }
54 
55 template<typename NumericalRep>
57 {
58 
59  HeaderType header;
60  data::CandidateWindowConfig const& window_config = _config.window_config();
61  typename data::SpCcl<NumericalRep>::ConstDataIterator data_it = cand_list.data_begin(window_config.window());
62  typename data::SpCcl<NumericalRep>::ConstDataIterator data_end = cand_list.data_end();
63 
64  // Setting fixed meta data here
65  auto tf_blocks = cand_list.tf_blocks();
66  if (tf_blocks.size() == 0)
67  return false;
68 
69  _writer.fill_header(header,*(tf_blocks[0]));
70 
71  // Make sure its the first candidate to write it out
72  while(data_it != data_end)
73  {
74  PANDA_LOG_DEBUG << "start time updated:" << "\t" << data_it.start_time();
75  _start_times.push_back(data_it.start_time());
76  header.tstart(data_it.start_time());
77  _writer.write(header, *(data_it));
78  ++data_it;
79  }
80 
81  return true;
82 }
83 
84 } // namespace exporters
85 } // namespace cheetah
86 } // namespace ska
ConstDataIterator data_begin(CandidateWindow const &window) const
Extract data corresponding to the candidates start and end times.
Definition: SpCcl.cpp:197
BlocksType const & tf_blocks() const
Access the TimeFrequency blocks associated with the single pulse candidtes.
Definition: SpCcl.cpp:64
Some limits and constants for FLDO.
Definition: Brdz.h:35
Config Module for initialising a CandidateWindow object.
bool operator<<(data::SpCcl< NumericalRep > const &cand_list)
Operator for iterating through candidates to extract filterbank data.
SpCandidate list.
Definition: SpCcl.h:52
CandidateWindow const & window() const
the confugred CandidateWindow
utils::ModifiedJulianClock::time_point const & start_time() const
: Get the start time
Definition: SpCcl.cpp:362