SourceXtractorPlusPlus  0.15
Please provide a description of the project.
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 
28  declareDependency<PythonConfig>();
29 }
30 
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
SourceXtractor::AperturePhotometryConfig::getApertures
const std::map< unsigned, std::vector< float > > & getApertures() const
Definition: AperturePhotometryConfig.cpp:67
SourceXtractor::AperturePhotometryConfig::m_apertures
std::map< unsigned, std::vector< float > > m_apertures
Definition: AperturePhotometryConfig.h:45
SourceXtractor::AperturePhotometryConfig::initialize
void initialize(const UserValues &args) override
Definition: AperturePhotometryConfig.cpp:31
std::vector< float >
std::map::find
T find(T... args)
std::map::emplace
T emplace(T... args)
SourceXtractor::AperturePhotometryConfig::m_output_images
std::map< std::string, std::vector< unsigned > > m_output_images
Definition: AperturePhotometryConfig.h:47
SourceXtractor
Definition: Aperture.h:30
PythonConfig.h
SourceXtractor::AperturePhotometryConfig::AperturePhotometryConfig
AperturePhotometryConfig(long manager_id)
Definition: AperturePhotometryConfig.cpp:27
std::map
STL class.
Euclid::Configuration::Configuration
std::map::end
T end(T... args)
SourceXtractor::AperturePhotometryConfig::getAperturesForImage
std::vector< float > getAperturesForImage(unsigned image_id) const
Definition: AperturePhotometryConfig.cpp:59
AperturePhotometryConfig.h