SourceXtractorPlusPlus  0.11
Please provide a description of the project.
VignetConfig.cpp
Go to the documentation of this file.
1 
17 /*
18  * @file VignetConfig.cpp
19  * @author mkuemmel
20  */
21 
25 
26 using namespace Euclid::Configuration;
27 namespace po = boost::program_options;
28 
29 namespace SourceXtractor {
30 
31 static const std::string VIGNET_SIZE {"vignet-size" };
32 static const std::string VIGNET_DEFAULT_PIXVAL {"vignet-default-pixval" };
33 
34 VignetConfig::VignetConfig(long manager_id) :
35  Configuration(manager_id),
36  m_vignet_size(),
37  m_vignet_default_pixval() {
38 }
39 
41  return { {"Vignet output", {
42  {VIGNET_SIZE.c_str(), po::value<std::string>()->default_value(std::string("15,15")),
43  "X- and Y-size of the vignet."},
44  {VIGNET_DEFAULT_PIXVAL.c_str(), po::value<double>()->default_value(std::nan("")), //Note: the SE2 value is "1.0E30", but nan is more consistent
45  "Default pixel value for the vignet data"},
46  }}};
47 }
48 
50  auto vignet_iter = args.find(VIGNET_SIZE);
51  if (vignet_iter != args.end()) {
52  auto vignet_str = vignet_iter->second.as<std::string>();
53  auto vignet_vector = Euclid::stringToVector<int>(vignet_str);
54  if (vignet_vector.size() > 2) {
55  throw Elements::Exception() << VIGNET_SIZE << " only accepts one or two numbers";
56  }
57  m_vignet_size[0] = vignet_vector.front();
58  m_vignet_size[1] = vignet_vector.back();
59  if (m_vignet_size[0] < 0 || m_vignet_size[1] < 0) {
60  throw Elements::Exception() << VIGNET_SIZE << " only accept positive numbers";
61  }
62  }
63  if (args.find(VIGNET_DEFAULT_PIXVAL) != args.end()) {
64  m_vignet_default_pixval = args.find(VIGNET_DEFAULT_PIXVAL)->second.as<double>();
65  }
66 }
67 
68 } // SourceXtractor namespace
std::nan
T nan(T... args)
std::string
STL class.
std::map::find
T find(T... args)
std::string::size
T size(T... args)
SourceXtractor::VignetConfig::m_vignet_default_pixval
double m_vignet_default_pixval
Definition: VignetConfig.h:52
std::string::back
T back(T... args)
SourceXtractor::VignetConfig::m_vignet_size
std::array< int, 2 > m_vignet_size
Definition: VignetConfig.h:51
std::string::front
T front(T... args)
Euclid::Configuration
SourceXtractor
Definition: Aperture.h:30
StringUtils.h
std::string::c_str
T c_str(T... args)
VignetConfig.h
Elements::Exception
ProcessedImage.h
std::map
STL class.
SourceXtractor::VIGNET_DEFAULT_PIXVAL
static const std::string VIGNET_DEFAULT_PIXVAL
Definition: VignetConfig.cpp:32
SourceXtractor::VIGNET_SIZE
static const std::string VIGNET_SIZE
Definition: VignetConfig.cpp:31
SourceXtractor::VignetConfig::initialize
void initialize(const UserValues &args) override
Definition: VignetConfig.cpp:49
SourceXtractor::VignetConfig::getProgramOptions
std::map< std::string, Configuration::OptionDescriptionList > getProgramOptions() override
Definition: VignetConfig.cpp:40
Euclid::Configuration::Configuration
std::map::end
T end(T... args)