SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
VignetConfig.cpp
Go to the documentation of this file.
1
17/*
18 * @file VignetConfig.cpp
19 * @author mkuemmel
20 */
21
22#include <AlexandriaKernel/StringUtils.h>
25
26using namespace Euclid::Configuration;
27namespace po = boost::program_options;
28
29namespace SourceXtractor {
30
31static const std::string VIGNET_SIZE {"vignet-size" };
32static const std::string VIGNET_DEFAULT_PIXVAL {"vignet-default-pixval" };
33
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::array< int, 2 > m_vignet_size
std::map< std::string, Configuration::OptionDescriptionList > getProgramOptions() override
void initialize(const UserValues &args) override
static const std::string VIGNET_SIZE
static const std::string VIGNET_DEFAULT_PIXVAL
T nan(T... args)