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/spsift/Config.h"
25 
26 namespace ska {
27 namespace cheetah {
28 namespace spsift {
29 
30 
31 Config::Config()
32  : utils::Config("spsift")
33  , _pulse_width_threshold(MsecTimeType(10.0 * cheetah::data::milliseconds))
34  , _sigma_threshold(0.0)
35  , _dm_threshold(0.0 * pss::astrotypes::units::parsecs_per_cube_cm)
36  , _maximum_candidates(0)
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 SpSift if true"
50  )
51  ("dm_thresh", boost::program_options::value<float>()->default_value(_dm_threshold.value())->notifier(
52  [&](float f)
53  {
54  _dm_threshold = f * pss::astrotypes::units::parsecs_per_cube_cm;
55  }), "DM threshold in cm^-3 pc"
56  )
57  ("sigma_thresh", boost::program_options::value<float>(&_sigma_threshold)->default_value(_sigma_threshold),
58  "S/N threshold for candidates to sift,"
59  )
60  ("pulse_width_threshold", boost::program_options::value<float>()->default_value(_pulse_width_threshold.value())->notifier(
61  [&](float f)
62  {
63  _pulse_width_threshold = MsecTimeType(f * cheetah::data::milliseconds);
64  }), "Pulse width threshold in ms"
65  )
66  ("maximum_candidates", boost::program_options::value<std::size_t>(&_maximum_candidates)->default_value(_maximum_candidates),
67  "Threshold for maximum number of candidates. If the number of candidates exceeds the threshold then we resize the list to the threshold. A value of 0 sets the threshold to unlimited."
68  );
69 }
70 
71 typename Config::Dm Config::dm_threshold() const
72 {
73  return _dm_threshold;
74 }
75 
76 void Config::dm_threshold( Dm const& dm_threshold)
77 {
78  _dm_threshold = dm_threshold;
79 }
80 
81 typename Config::MsecTimeType Config::pulse_width_threshold() const
82 {
83  return _pulse_width_threshold;
84 }
85 
86 void Config::pulse_width_threshold(MsecTimeType const& pulse_width_threshold)
87 {
88  _pulse_width_threshold = pulse_width_threshold;
89 }
90 
91 float Config::sigma_threshold() const
92 {
93  return _sigma_threshold;
94 }
95 
96 void Config::sigma_threshold(float const& sigma_threshold)
97 {
98  _sigma_threshold = sigma_threshold;
99 }
100 
101 std::size_t Config::maximum_candidates() const
102 {
103  return _maximum_candidates;
104 }
105 
106 void Config::maximum_candidates(std::size_t const& maximum_candidates)
107 {
108  _maximum_candidates = maximum_candidates;
109 }
110 
111 bool Config::active() const
112 {
113  return _active;
114 }
115 
116 } // namespace spsift
117 } // namespace cheetah
118 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35