Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
SpCandidateData.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_DATA_SPCANDIDATEDATA_H
25 #define SKA_CHEETAH_DATA_SPCANDIDATEDATA_H
26 
27 #include "TimeFrequency.h"
28 #include "ExtendedTimeFrequency.h"
29 #include "SpCandidate.h"
30 #include <pss/astrotypes/types/ExtendedTimeFrequency.h>
31 #include <vector>
32 
33 namespace ska {
34 namespace cheetah {
35 namespace data {
36 
42 template<typename TimeFrequencyT>
43 class SpCandidateData : public ExtendedTimeFrequency<TimeFrequencyT>
44  , public panda::DataChunk<SpCandidateData<TimeFrequencyT>>
45 {
47 
48  public:
49  template<typename T>
50  class Candidate {
51  public:
52  typedef DedispersionMeasureType<T> Dm;
53  typedef boost::units::quantity<MilliSeconds, double> MsecTimeType;
54  typedef MsecTimeType Width;
55  typedef MsecTimeType Duration;
56  typedef pss::astrotypes::units::ModifiedJulianClock::time_point TimePointType;
57  typedef T Sigma;
58  typedef boost::units::quantity<MegaHertz, double> FrequencyType;
59 
60  public:
61  Candidate();
62  Candidate(Dm dm, TimePointType start_time_mjd, Width width, Duration duration, T sigma);
63 
69  TimePointType const & start_time() const;
70 
74  Duration const& duration() const;
75 
87  Dm const & dm() const;
88 
96  Width const & width() const;
97 
110  Sigma const& sigma() const;
111 
112  private:
113  Dm _dm;
114  TimePointType _start_time;
115  Duration _duration;
116  Width _width;
117  Sigma _sigma = 0.;
118  };
119 
120  private:
121  typedef std::vector<Candidate<float>> CandidateContainer;
122 
123  public:
124  typedef TimeFrequencyT TimeFrequencyType;
125  typedef typename CandidateContainer::value_type CandidateType;
126  typedef typename CandidateContainer::const_iterator ConstCandidateIterator;
127 
128  public:
129  SpCandidateData();
130  SpCandidateData(std::shared_ptr<TimeFrequencyT> const&);
131  ~SpCandidateData();
132 
137  void add(CandidateType&& candidate);
138 
142  ConstCandidateIterator begin_candidates() const;
143 
147  ConstCandidateIterator end_candidates() const;
148 
152  CandidateType const& candidate(std::size_t candidate_number) const;
153 
157  std::size_t number_of_candidates() const;
158 
159  private:
160  CandidateContainer _cands;
161 };
162 
163 
164 } // namespace data
165 } // namespace cheetah
166 } // namespace ska
167 #include "detail/SpCandidateData.cpp"
168 
169 #endif // SKA_CHEETAH_DATA_SPCANDIDATEDATA_H
Wrapper around a TimeFrequency type object (or shared_ptr to such) mainiting the TimeFrequency interf...
TimePointType const & start_time() const
Get the start time of the candidate.
Some limits and constants for FLDO.
Definition: Brdz.h:35
std::size_t number_of_candidates() const
the number of candidates associated with this data
Duration const & duration() const
The duration in time of the candidate pulse.
ConstCandidateIterator begin_candidates() const
Iterator over the candidates.
SpCandidates associated with a single data chank.
Width const & width() const
access a reference to width.
Dm const & dm() const
access a reference to dm.
CandidateType const & candidate(std::size_t candidate_number) const
get the correspondin numbered candidate (<= number_of_candidates())
Sigma const & sigma() const
access a reference to standard deviation (sigma).
void add(CandidateType &&candidate)
add a Candidate to the candidates list
ConstCandidateIterator end_candidates() const
Iterator marking the end of any candidates.