SourceXtractorPlusPlus  0.10
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LegacyModelFittingConfig.cpp
Go to the documentation of this file.
1 
17 /*
18  * ModelFittingConfig.cpp
19  *
20  * Created on: May 17, 2017
21  * Author: mschefer
22  */
23 
25 
26 using namespace Euclid::Configuration;
27 namespace po = boost::program_options;
28 
29 namespace SourceXtractor {
30 
31 static const std::string MFIT_MAX_ITERATIONS {"model-fitting-iterations"};
32 static const std::string MFIT_ENGINE {"model-fitting-engine"};
33 
34 LegacyModelFittingConfig::LegacyModelFittingConfig(long manager_id) : Configuration(manager_id), m_max_iterations(1000) {
35 }
36 
38  return {{"Model Fitting",
39  {
40  {MFIT_MAX_ITERATIONS.c_str(), po::value<int>()->default_value(1000),
41  "Maximum number of iterations allowed for model fitting"},
42  {MFIT_ENGINE.c_str(), po::value<std::string>()->default_value("levmar"),
43  "Least squares engine"}
44  }
45  }};
46 }
47 
48 void LegacyModelFittingConfig::initialize(const UserValues& args) {
49  m_max_iterations = args.at(MFIT_MAX_ITERATIONS).as<int>();
50  if (m_max_iterations <= 0) {
51  throw Elements::Exception() << "Invalid " << MFIT_MAX_ITERATIONS << " value: " << m_max_iterations;
52  }
54 }
55 
56 } /* namespace SourceXtractor */
57 
58 
STL class.
STL class.
T at(T...args)
static const std::string MFIT_ENGINE
static const std::string MFIT_MAX_ITERATIONS
std::map< std::string, OptionDescriptionList > getProgramOptions() override
T c_str(T...args)
void initialize(const UserValues &args) override