SourceXtractorPlusPlus  0.10
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AperturePhotometryConfig.cpp
Go to the documentation of this file.
1 
17 /*
18  * @file AperturePhotometryConfig.cpp
19  * @author Alejandro Alvarez Ayllon
20  */
21 
24 
25 namespace SourceXtractor {
26 
27 AperturePhotometryConfig::AperturePhotometryConfig(long manager_id): Configuration(manager_id) {
28  declareDependency<PythonConfig>();
29 }
30 
31 void AperturePhotometryConfig::initialize(const Euclid::Configuration::Configuration::UserValues& /*args*/) {
32  auto& py = getDependency<PythonConfig>().getInterpreter();
33 
34  // Used to get the image corresponding to a given aperture ID
35  std::map<unsigned, unsigned> ap_id_to_img;
36 
37  // These are the apertures we need to compute for each image
38  auto apertures = py.getApertures();
39  for (auto& a : apertures) {
40  m_apertures.emplace(a.first, a.second.apertures);
41  ap_id_to_img.emplace(a.second.id, a.first);
42  }
43 
44  // And these are the output columns. If several apertures are defined together, they go out together
45  auto output_columns = py.getApertureOutputColumns();
46  for (auto& oc : output_columns) {
47  auto col_name = oc.first;
48  for (auto& ap_id : oc.second) {
49  auto img_id_iter = ap_id_to_img.find(ap_id);
50  if (img_id_iter != ap_id_to_img.end()) {
51  auto img_id = img_id_iter->second;
52  // Which images ID correspond to an output column
53  m_output_images[col_name].push_back(img_id);
54  }
55  }
56  }
57 }
58 
60  auto i = m_apertures.find(image_id);
61  if (i == m_apertures.end()) {
62  return {};
63  }
64  return i->second;
65 }
66 
68  return m_apertures;
69 }
70 
71 } // end SourceXtractor
T end(T...args)
std::vector< float > getAperturesForImage(unsigned image_id) const
STL class.
const std::map< unsigned, std::vector< float > > & getApertures() const
std::map< unsigned, std::vector< float > > m_apertures
T find(T...args)
T emplace(T...args)
std::map< std::string, std::vector< unsigned > > m_output_images
void initialize(const UserValues &args) override