SourceXtractorPlusPlus
0.19.2
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
AperturePhotometry
AperturePhotometryConfig.cpp
Go to the documentation of this file.
1
17
/*
18
* @file AperturePhotometryConfig.cpp
19
* @author Alejandro Alvarez Ayllon
20
*/
21
22
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometryConfig.h
"
23
#include "
SEImplementation/Configuration/PythonConfig.h
"
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
59
std::vector<float>
AperturePhotometryConfig::getAperturesForImage
(
unsigned
image_id)
const
{
60
auto
i =
m_apertures
.
find
(image_id);
61
if
(i ==
m_apertures
.
end
()) {
62
return
{};
63
}
64
return
i->second;
65
}
66
67
const
std::map<unsigned, std::vector<float>
>&
AperturePhotometryConfig::getApertures
()
const
{
68
return
m_apertures
;
69
}
70
71
}
// end SourceXtractor
AperturePhotometryConfig.h
PythonConfig.h
Euclid::Configuration::Configuration
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::AperturePhotometryConfig
AperturePhotometryConfig(long manager_id)
Definition
AperturePhotometryConfig.cpp:27
SourceXtractor::AperturePhotometryConfig::getAperturesForImage
std::vector< float > getAperturesForImage(unsigned image_id) const
Definition
AperturePhotometryConfig.cpp:59
SourceXtractor::AperturePhotometryConfig::m_output_images
std::map< std::string, std::vector< unsigned > > m_output_images
Definition
AperturePhotometryConfig.h:47
SourceXtractor::AperturePhotometryConfig::initialize
void initialize(const UserValues &args) override
Definition
AperturePhotometryConfig.cpp:31
std::map::emplace
T emplace(T... args)
std::map::end
T end(T... args)
std::map::find
T find(T... args)
std::map
SourceXtractor
Definition
Aperture.h:30
boost::python
std::vector
Generated by
1.9.7