24 #include "cheetah/generators/GeneratorAppConfig.h" 25 #include "cheetah/data/Units.h" 26 #include "cheetah/version.h" 31 namespace generators {
34 GeneratorAppConfig::GeneratorAppConfig(std::string
const& app_name, std::string
const& description)
35 : BasicAppConfig(app_name, description)
36 , _number_of_chunks(1)
37 , _number_of_channels(1024)
38 , _number_of_time_samples(4096)
39 , _frequency(1200.0 *
boost::units::si::mega * data::hz)
40 , _channel_width(-300.0 *
boost::units::si::kilo * data::hz)
41 , _sample_interval(1.0 *
boost::units::si::milli *
boost::units::si::seconds)
43 add(_generator_config);
47 GeneratorAppConfig::~GeneratorAppConfig()
53 return _generator_config;
58 return _sigproc_config;
61 std::string GeneratorAppConfig::version()
const 63 return std::string(cheetah::version) +
"\n" + BasicAppConfig::version();
66 void GeneratorAppConfig::add_options(OptionsDescriptionEasyInit& add_options)
69 (
"list-generators", boost::program_options::bool_switch()->notifier([
this](
bool b)
72 for(
auto const& gen : _generator_keys) {
73 std::cout <<
"\t" << gen <<
"\n";
77 }),
"display a list of generators available")
78 (
"generator,g", boost::program_options::value<std::vector<std::string>>(&_generator_selected)
79 ,
"the name of the generator to use as a data model (see --list-generators)")
80 (
"channels", boost::program_options::value<std::size_t>(&_number_of_channels)->default_value(_number_of_channels)
81 ,
"the number of channels in each block of data")
82 (
"samples", boost::program_options::value<std::size_t>(&_number_of_time_samples)->default_value(_number_of_time_samples)
83 ,
"the number of time samples in each block of data")
84 (
"chunks", boost::program_options::value<std::size_t>(&_number_of_chunks)->default_value(_number_of_chunks)
85 ,
"the number of block of data to generate")
86 (
"start_freq", boost::program_options::value<typename FrequencyType::value_type>()->default_value(_frequency.value())
87 ->notifier([
this](
typename FrequencyType::value_type
const& val)
89 _frequency = val * boost::units::si::mega * data::hertz;
91 ,
"the frequency of the first channel (MHz)")
92 (
"channel_width", boost::program_options::value<typename FrequencyType::value_type>()->default_value(_channel_width.value())
93 ->notifier([
this](
typename FrequencyType::value_type
const& val)
95 _channel_width = val * boost::units::si::mega * data::hertz;
97 ,
"the width of each channel (MHz)")
98 (
"sample_interval", boost::program_options::value<typename IntervalType::value_type>()->default_value(_sample_interval.value())
99 ->notifier([
this](
typename IntervalType::value_type
const& val)
101 _sample_interval= val * boost::units::si::seconds;
103 ,
"the width of each channel (MHz)");
108 _generator_keys = generator_names;
113 return _generator_keys;
118 return _generator_selected;
123 return _number_of_chunks;
128 return _number_of_time_samples;
133 return _number_of_channels;
143 return _channel_width;
148 return _sample_interval;
std::vector< std::string > const & generator_list() const
list the known generators
void set_generator_list(std::vector< std::string > const &generator_names)
set the known generators
ska::cheetah::generators::Config & generator_config()
return the generator configuration object
Generator Configuration file.
FrequencyType channel_width() const
return the channel width (homgenous cwidth channels)
Configuration options for a SigProcWriter.
std::vector< std::string > const & data_generator() const
return the chosen data model
Some limits and constants for FLDO.
sigproc::WriterConfig const & sigproc_config() const
return the configuration object for directing sigproc writer
std::size_t number_of_time_samples() const
return the number of time smaples per data chunk
IntervalType sample_interval() const
sample interval (in seconds)
FrequencyType start_frequency() const
return the start frequency
std::size_t number_of_chunks() const
return the number of data chunks to produce for the data file
std::size_t number_of_channels() const
return the number of channels for each data chunk