24 #include "cheetah/generators/PulsarInjectionConfig.h" 25 #include <panda/Error.h> 31 namespace generators {
34 PulsarInjectionConfig::PulsarInjectionConfig(std::string
const& tag_name)
35 : utils::Config(tag_name)
36 , _signal_to_noise(10)
38 , _profile_name(
"B0011+47")
39 , _phase_model_factory(*this)
40 , _dm(0.0*data::parsecs_per_cube_cm)
42 add(_simple_phase_model_config);
43 add(_tempo2_phase_model_config);
46 PulsarInjectionConfig::~PulsarInjectionConfig()
50 void PulsarInjectionConfig::add_options(OptionsDescriptionEasyInit& add_options)
52 std::vector<std::string>
const& phase_model_types = _phase_model_factory.types();
53 std::string
const phase_model_type_help =
"phase model type to use (valid types: " + std::accumulate( std::next(phase_model_types.begin())
54 , phase_model_types.end()
55 , *phase_model_types.begin()
56 , [](
const std::string& a,
const std::string& b) {
61 (
"profile", boost::program_options::value<std::string>()->notifier([&](std::string
const& p) { _profile_name=
static_cast<PulsarProfileId
>(p); }),
"The name of the pulsar profile to emulate")
62 (
"snr", boost::program_options::value<float>(&_signal_to_noise)->default_value(_signal_to_noise),
"Target signal-to-noise ratio (phase average S/N)")
63 (
"spectral_index", boost::program_options::value<float>(&_spectral_index)->default_value(_spectral_index),
"Target spectral index")
64 (
"dm", boost::program_options::value<double>()->default_value(_dm.value())->notifier(
66 _dm = dm * data::parsecs_per_cube_cm;
69 ,
"dedispersion measure (pc/cm^3)")
70 (
"phase_model", boost::program_options::value<std::string>()->default_value(
"simple")->notifier(
71 [&](std::string
const type) {
75 , phase_model_type_help.c_str() )
81 return _signal_to_noise;
86 _signal_to_noise = snr;
101 _spectral_index = si;
106 return _spectral_index;
111 if(!_phase_model)
throw panda::Error(
"phase model not specified");
117 _phase_model=_phase_model_factory.create(type);
122 _simple_phase_model_config = config;
123 phase_model(
"simple");
128 _tempo2_phase_model_config = config;
129 phase_model(
"tempo2");
Configuration parameters for the SimplePhase Model.
PulsarProfileId const & profile() const
the name of the pulse profile to emulate
data::DedispersionMeasureType< double > dm() const
the dedisperion measure to emulate
configuration parameters for a tempo2 predictor model
Some limits and constants for FLDO.
placeholder for specifying pulsar profile database URI
float spectral_index() const
get the spectral index to emulate
void set_phase_model(SimplePhaseModelConfig const &)
set the phase model to single type with the speocife settings
PhaseModelType const & phase_model() const
return the phase model that has benn specified
float signal_to_noise() const
signal to nosie ratio to emulate