SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
AperturePhotometry
AperturePhotometryTaskFactory.cpp
Go to the documentation of this file.
1
17
/*
18
* AperturePhotometryTaskFactory.cpp
19
*
20
* Created on: Sep 23, 2016
21
* Author: mschefer
22
*/
23
24
#include <sstream>
25
26
#include "
SEFramework/Property/PropertyId.h
"
27
#include "
SEFramework/Task/Task.h
"
28
29
#include "
SEImplementation/Configuration/MagnitudeConfig.h
"
30
#include "
SEImplementation/Configuration/WeightImageConfig.h
"
31
#include "
SEImplementation/Plugin/AperturePhotometry/ApertureFlag.h
"
32
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometryArray.h
"
33
#include "
SEImplementation/Plugin/AperturePhotometry/ApertureFlagTask.h
"
34
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometry.h
"
35
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometryTask.h
"
36
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometryArrayTask.h
"
37
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometryTaskFactory.h
"
38
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometryConfig.h
"
39
#include "
SEImplementation/Configuration/MeasurementImageConfig.h
"
40
41
namespace
SourceXtractor
{
42
43
std::shared_ptr<Task>
AperturePhotometryTaskFactory::createTask
(
const
PropertyId
&
property_id
)
const
{
44
auto
instance
=
property_id
.getIndex();
45
46
if
(
property_id
.getTypeId() ==
typeid
(
AperturePhotometry
)) {
47
return
std::make_shared<AperturePhotometryTask>
(
48
m_aperture_config
.
at
(
instance
),
49
instance
,
50
m_magnitude_zero_point
,
51
m_symmetry_usage
52
);
53
}
else
if
(
property_id
.getTypeId() ==
typeid
(
AperturePhotometryArray
)) {
54
return
std::make_shared<AperturePhotometryArrayTask>
(
55
m_apertures_per_output
.
at
(
instance
),
56
instance
57
);
58
}
else
if
(
property_id
== PropertyId::create<ApertureFlag>()) {
59
return
std::make_shared<ApertureFlagTask>
(
m_all_apertures
);
60
}
61
return
nullptr
;
62
}
63
64
void
AperturePhotometryTaskFactory::registerPropertyInstances
(
OutputRegistry
&
registry
) {
65
std::vector<std::pair<std::string, unsigned int>
>
flux_instances
,
flux_err_instances
;
66
std::vector<std::pair<std::string, unsigned int>
>
mag_instances
,
mag_err_instances
;
67
std::vector<std::pair<std::string, unsigned int>
>
flags_instances
;
68
69
for
(
auto
&
aggregated_ap
:
m_apertures_per_output
) {
70
auto
&
array_id
=
aggregated_ap
.first;
71
72
std::string
name =
m_col_prefix
.
at
(
array_id
);
73
74
flux_instances
.emplace_back(
std::make_pair
(name +
"_flux"
,
array_id
));
75
flux_err_instances
.emplace_back(
std::make_pair
(name +
"_flux_err"
,
array_id
));
76
mag_instances
.emplace_back(
std::make_pair
(name +
"_mag"
,
array_id
));
77
mag_err_instances
.emplace_back(
std::make_pair
(name +
"_mag_err"
,
array_id
));
78
flags_instances
.emplace_back(
std::make_pair
(name +
"_flags"
,
array_id
));
79
}
80
81
registry
.registerPropertyInstances<
AperturePhotometryArray
>(
"aperture_flux"
,
flux_instances
);
82
registry
.registerPropertyInstances<
AperturePhotometryArray
>(
"aperture_flux_err"
,
flux_err_instances
);
83
registry
.registerPropertyInstances<
AperturePhotometryArray
>(
"aperture_mag"
,
mag_instances
);
84
registry
.registerPropertyInstances<
AperturePhotometryArray
>(
"aperture_mag_err"
,
mag_err_instances
);
85
registry
.registerPropertyInstances<
AperturePhotometryArray
>(
"aperture_flags"
,
flags_instances
);
86
}
87
88
void
AperturePhotometryTaskFactory::reportConfigDependencies
(
Euclid::Configuration::ConfigManager
&
manager
)
const
{
89
manager
.registerConfiguration<
MagnitudeConfig
>();
90
manager
.registerConfiguration<
WeightImageConfig
>();
91
manager
.registerConfiguration<
AperturePhotometryConfig
>();
92
manager
.registerConfiguration<
MeasurementImageConfig
>();
93
}
94
95
void
AperturePhotometryTaskFactory::configure
(
Euclid::Configuration::ConfigManager
&
manager
) {
96
auto
& measurement_config =
manager
.getConfiguration<
MeasurementImageConfig
>();
97
auto
&
aperture_config
=
manager
.getConfiguration<
AperturePhotometryConfig
>();
98
99
const
auto
&
image_infos
= measurement_config.getImageInfos();
100
101
m_aperture_config
=
aperture_config
.getApertures();
102
m_magnitude_zero_point
=
manager
.getConfiguration<
MagnitudeConfig
>().getMagnitudeZeroPoint();
103
m_symmetry_usage
=
manager
.getConfiguration<
WeightImageConfig
>().symmetryUsage();
104
105
for
(
unsigned
int
i
= 0;
i
<
image_infos
.size(); ++
i
) {
106
for
(
auto
a :
aperture_config
.getAperturesForImage(
image_infos
[
i
].m_id)) {
107
if
(
std::find
(
m_all_apertures
.
begin
(),
m_all_apertures
.
end
(), a) ==
m_all_apertures
.
end
()) {
108
m_all_apertures
.
emplace_back
(a);
109
}
110
}
111
}
112
113
auto
outputs
=
aperture_config
.getImagesToOutput();
114
unsigned
i
= 0;
115
for
(
auto
j
=
outputs
.begin();
j
!=
outputs
.end(); ++
i
, ++
j
) {
116
m_col_prefix
[
i
] =
j
->first;
117
m_apertures_per_output
[
i
] =
j
->second;
118
}
119
}
120
121
}
122
ApertureFlagTask.h
ApertureFlag.h
AperturePhotometryArrayTask.h
AperturePhotometryArray.h
AperturePhotometryConfig.h
AperturePhotometryTaskFactory.h
AperturePhotometryTask.h
AperturePhotometry.h
MagnitudeConfig.h
MeasurementImageConfig.h
PropertyId.h
Task.h
WeightImageConfig.h
std::map::at
T at(T... args)
std::string
std::vector::begin
T begin(T... args)
Euclid::Configuration::ConfigManager
SourceXtractor::AperturePhotometryArray
Merges all AperturePhotometries into a multidimensional property.
Definition
AperturePhotometryArray.h:40
SourceXtractor::AperturePhotometryConfig
Definition
AperturePhotometryConfig.h:29
SourceXtractor::AperturePhotometryTaskFactory::createTask
std::shared_ptr< Task > createTask(const PropertyId &property_id) const override
Returns a Task producing a Property corresponding to the given PropertyId.
Definition
AperturePhotometryTaskFactory.cpp:43
SourceXtractor::AperturePhotometryTaskFactory::registerPropertyInstances
void registerPropertyInstances(OutputRegistry &) override
Definition
AperturePhotometryTaskFactory.cpp:64
SourceXtractor::AperturePhotometryTaskFactory::m_magnitude_zero_point
SeFloat m_magnitude_zero_point
Definition
AperturePhotometryTaskFactory.h:64
SourceXtractor::AperturePhotometryTaskFactory::configure
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition
AperturePhotometryTaskFactory.cpp:95
SourceXtractor::AperturePhotometryTaskFactory::m_aperture_config
std::map< unsigned, std::vector< float > > m_aperture_config
Definition
AperturePhotometryTaskFactory.h:68
SourceXtractor::AperturePhotometryTaskFactory::m_apertures_per_output
std::map< unsigned, std::vector< unsigned > > m_apertures_per_output
Definition
AperturePhotometryTaskFactory.h:73
SourceXtractor::AperturePhotometryTaskFactory::m_symmetry_usage
bool m_symmetry_usage
Definition
AperturePhotometryTaskFactory.h:65
SourceXtractor::AperturePhotometryTaskFactory::reportConfigDependencies
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition
AperturePhotometryTaskFactory.cpp:88
SourceXtractor::AperturePhotometryTaskFactory::m_all_apertures
std::vector< float > m_all_apertures
Definition
AperturePhotometryTaskFactory.h:70
SourceXtractor::AperturePhotometryTaskFactory::m_col_prefix
std::map< unsigned, std::string > m_col_prefix
Definition
AperturePhotometryTaskFactory.h:72
SourceXtractor::AperturePhotometry
Aperture photometry fluxes and magnitudes.
Definition
AperturePhotometry.h:38
SourceXtractor::MagnitudeConfig
Definition
MagnitudeConfig.h:32
SourceXtractor::MeasurementImageConfig
Definition
MeasurementImageConfig.h:37
SourceXtractor::OutputRegistry
Definition
OutputRegistry.h:37
SourceXtractor::PropertyId
Identifier used to set and retrieve properties.
Definition
PropertyId.h:40
SourceXtractor::WeightImageConfig
Definition
WeightImageConfig.h:32
std::vector::emplace_back
T emplace_back(T... args)
std::vector::end
T end(T... args)
std::find
T find(T... args)
std::function
std::make_pair
T make_pair(T... args)
SourceXtractor
Definition
Aperture.h:30
Generated by
1.10.0