Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Config.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/sps_clustering/Config.h"
25 
26 namespace ska {
27 namespace cheetah {
28 namespace sps_clustering {
29 
30 
31 Config::Config()
32  : utils::Config("sps_clustering")
33  , _pulse_width_tolerance(5 * cheetah::data::milliseconds)
34  , _time_tolerance(100 * cheetah::data::milliseconds)
35  , _dm_tolerance(1 * pss::astrotypes::units::parsecs_per_cube_cm)
36  , _linking_length(1.7)
37  , _active(true)
38 {
39 }
40 
41 Config::~Config()
42 {
43 }
44 
45 void Config::add_options(OptionsDescriptionEasyInit& add_options )
46 {
47  add_options
48  ("active", boost::program_options::value<bool>(&_active)->default_value(_active),
49  "perform SpsClustering if true"
50  )
51  ("number_of_threads", boost::program_options::value<std::size_t>(&_num_threads)->default_value(1),
52  "number of threads to use for clustering"
53  )
54  ("time_tolerance", boost::program_options::value<float>()->notifier(
55  [&](float f)
56  {
57  _time_tolerance = MsecTimeType(f * cheetah::data::milliseconds);
58  }), "start time tolerance in ms to cluster candidates in time space."
59  )
60  ("dm_thresh", boost::program_options::value<float>()->notifier(
61  [&](float f)
62  {
63  _dm_tolerance = f * pss::astrotypes::units::parsecs_per_cube_cm;
64  }), "DM tolerance in cm^-3 pc to cluster candidates in DM space"
65  )
66  ("pulse_width_tolerance", boost::program_options::value<float>()->notifier(
67  [&](float f)
68  {
69  _pulse_width_tolerance = MsecTimeType(f * cheetah::data::milliseconds);
70  }), "Pulse width tolerance in ms to cluster candidates in pulse width space."
71  )
72  ("linking_length", boost::program_options::value<float>(&_linking_length)->default_value(1.7),
73  "Linking length for clustering. This is the Euclidean distance in our parameter space inside which all candidates are considered part of the same cluster."
74  );
75 }
76 
77 typename Config::Dm Config::dm_tolerance() const
78 {
79  return _dm_tolerance;
80 }
81 
82 void Config::dm_tolerance( Dm const& dm_tolerance)
83 {
84  _dm_tolerance = dm_tolerance;
85 }
86 
87 typename Config::MsecTimeType Config::pulse_width_tolerance() const
88 {
89  return _pulse_width_tolerance;
90 }
91 
92 void Config::pulse_width_tolerance(MsecTimeType const& pulse_width_tolerance)
93 {
94  _pulse_width_tolerance = pulse_width_tolerance;
95 }
96 
97 typename Config::MsecTimeType Config::time_tolerance() const
98 {
99  return _time_tolerance;
100 }
101 
102 void Config::time_tolerance(MsecTimeType const& time_tolerance)
103 {
104  _time_tolerance = time_tolerance;
105 }
106 
107 float Config::linking_length() const
108 {
109  return _linking_length;
110 }
111 
112 void Config::linking_length(float const& l)
113 {
114  _linking_length = l;
115 }
116 
117 bool Config::active() const
118 {
119  return _active;
120 }
121 
122 std::size_t Config::num_threads() const
123 {
124  return _num_threads;
125 }
126 
127 void Config::num_threads(std::size_t const nt)
128 {
129  _num_threads = nt;
130 }
131 
132 } // namespace sps_clustering
133 } // namespace cheetah
134 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35