Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
SpCandidate.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 namespace ska {
25 namespace cheetah {
26 namespace data {
27 
28 
29 template <typename Arch, typename T>
31 {
32 }
33 
34 
35 template <typename Arch, typename T>
36 SpCandidate<Arch,T>::SpCandidate(SpCandidate<Arch,T>::Dm dm, SpCandidate<Arch, T>::MsecTimeType tstart, SpCandidate<Arch, T>::MsecTimeType width, T sigma, std::size_t ident)
37  : _dm(dm)
38  , _tstart(tstart)
39  , _tend(tstart)
40  , _width(width)
41  , _sigma(sigma)
42  , _ident(ident)
43 {
44 }
45 
46 template <typename Arch, typename T>
47 SpCandidate<Arch,T>::SpCandidate(SpCandidate<Arch,T>::Dm dm, MsecTimeType tstart, MsecTimeType width, MsecTimeType tend, T sigma, std::size_t ident)
48  : _dm(dm)
49  , _tstart(tstart)
50  , _tend(tend)
51  , _width(width)
52  , _sigma(sigma)
53  , _ident(ident)
54 {
55 }
56 
57 template <typename Arch, typename T>
58 SpCandidate<Arch,T>::SpCandidate(SpCandidate<Arch,T>::Dm dm, SpCandidate<Arch, T>::MsecTimeType tstart, SpCandidate<Arch, T>::MsecTimeType width, T sigma, FrequencyType f_low, FrequencyType f_high, std::size_t ident)
59  : _dm(dm)
60  , _tstart(tstart)
61  , _width(width)
62  , _sigma(sigma)
63  , _ident(ident)
64 {
65  MsecTimeType delay = (4.15 * 1000000.0 * boost::units::si::milli * boost::units::si::seconds) * ( _dm * ( (1/(f_low * f_low)) - (1/(f_high * f_high)) )).value();
66  this->_tend = _tstart + delay;
67 }
68 
69 template <typename Arch, typename T>
71 
72 
73 template <typename Arch, typename T>
74 typename SpCandidate<Arch,T>::MsecTimeType const& SpCandidate<Arch,T>::tstart() const
75 {
76  return this->_tstart;
77 }
78 
79 template <typename Arch, typename T>
80 void SpCandidate<Arch,T>::tstart(SpCandidate<Arch,T>::MsecTimeType c_tstart)
81 {
82  this->_tstart = c_tstart;
83 }
84 
85 template <typename Arch, typename T>
86 typename SpCandidate<Arch,T>::MsecTimeType const& SpCandidate<Arch,T>::tend() const
87 {
88  return this->_tend;
89 }
90 
91 template <typename Arch, typename T>
92 void SpCandidate<Arch,T>::tend(MsecTimeType tend)
93 {
94  this->_tend = tend;
95 }
96 
97 template <typename Arch, typename T>
98 void SpCandidate<Arch,T>::duration_end(SpCandidate<Arch,T>::MsecTimeType c_tend)
99 {
100  this->_tend = _tstart + c_tend;
101 }
102 
103 template <typename Arch, typename T>
104 void SpCandidate<Arch,T>::dm_with_duration_end(SpCandidate<Arch,T>::FrequencyType const& f_high, SpCandidate<Arch,T>::FrequencyType const& f_low, SpCandidate<Arch,T>::Dm const& dm)
105 {
106  // set the private member for dispersion measure here
107  _dm = dm;
108  //Calculate the DM smear based on the frequency
109  MsecTimeType delay = (4.15 * 1000000.0 * boost::units::si::milli * boost::units::si::seconds) * ( _dm * ( (1/(f_low * f_low)) - (1/(f_high * f_high)) )).value();
110  this->_tend = _tstart + delay;
111 }
112 
113 template <typename Arch, typename T>
114 typename SpCandidate<Arch,T>::Dm const & SpCandidate<Arch,T>::dm() const
115 {
116  return this->_dm;
117 }
118 
119 
120 template <typename Arch, typename T>
121 typename SpCandidate<Arch,T>::MsecTimeType const& SpCandidate<Arch,T>::width() const
122 {
123  return this->_width;
124 }
125 
126 template <typename Arch, typename T>
127 void SpCandidate<Arch,T>::width(SpCandidate<Arch,T>::MsecTimeType c_width)
128 {
129  this->_width = c_width;
130 }
131 
132 
133 template <typename Arch, typename T>
135 {
136  return this->_sigma;
137 }
138 
139 template <typename Arch, typename T>
141 {
142  this->_sigma = c_sigma;
143 }
144 
145 template <typename Arch, typename T>
146 std::size_t const& SpCandidate<Arch,T>::ident() const
147 {
148  return (this->_ident);
149 }
150 
151 template <typename Arch, typename T>
152 void SpCandidate<Arch,T>::ident(std::size_t c_ident)
153 {
154  this->_ident = c_ident;
155 }
156 
157 } // namespace data
158 } // namespace cheetah
159 } // namespace ska
160 
161 
162 
T const & sigma() const
access a reference to _sigma.
Dm const & dm() const
access a reference to dm.
SpCandidate()
Create a zero-sized SpCandidate.
Definition: SpCandidate.cpp:30
void dm_with_duration_end(FrequencyType const &f_high, FrequencyType const &f_low, Dm const &dm)
Set the end time : This step is important as the DM will be set along with the end time...
Some limits and constants for FLDO.
Definition: Brdz.h:35
MsecTimeType const & tstart() const
Get the start time of the candidate.
Definition: SpCandidate.cpp:74
std::size_t const & ident() const
access a reference to ident.
MsecTimeType const & width() const
access a reference to width.
void duration_end(MsecTimeType c_tend)
Set the end time The end time is calculated based on the DM of the candidate and the start and end f...
Definition: SpCandidate.cpp:98
MsecTimeType const & tend() const
Get the end time.
Definition: SpCandidate.cpp:86
~SpCandidate()
destroy a SpCandidate
Definition: SpCandidate.cpp:70