SourceXtractorPlusPlus  0.13
Please provide a description of the project.
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 
27 #include "SEFramework/Task/Task.h"
28 
40 
41 namespace SourceXtractor {
42 
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,
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 
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;
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 
93 }
94 
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)) {
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 
PropertyId.h
Euclid::Configuration::ConfigManager::registerConfiguration
void registerConfiguration()
ApertureFlagTask.h
SourceXtractor::MagnitudeConfig
Definition: MagnitudeConfig.h:32
std::string
STL class.
std::shared_ptr
STL class.
SourceXtractor::AperturePhotometryTaskFactory::configure
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition: AperturePhotometryTaskFactory.cpp:95
SourceXtractor::AperturePhotometryTaskFactory::m_all_apertures
std::vector< float > m_all_apertures
Definition: AperturePhotometryTaskFactory.h:70
Euclid::Configuration::ConfigManager
Task.h
SourceXtractor::AperturePhotometryTaskFactory::createTask
virtual 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
std::vector
STL class.
std::find
T find(T... args)
SourceXtractor::MeasurementImageConfig
Definition: MeasurementImageConfig.h:37
SourceXtractor::AperturePhotometryTaskFactory::m_symmetry_usage
bool m_symmetry_usage
Definition: AperturePhotometryTaskFactory.h:65
SourceXtractor::OutputRegistry
Definition: OutputRegistry.h:36
SourceXtractor::WeightImageConfig
Definition: WeightImageConfig.h:32
SourceXtractor::PropertyId::getTypeId
std::type_index getTypeId() const
Definition: PropertyId.h:66
Euclid::Configuration::ConfigManager::getConfiguration
T & getConfiguration()
AperturePhotometryArrayTask.h
WeightImageConfig.h
AperturePhotometryArray.h
SourceXtractor::AperturePhotometryTaskFactory::reportConfigDependencies
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition: AperturePhotometryTaskFactory.cpp:88
SourceXtractor::PropertyId
Identifier used to set and retrieve properties.
Definition: PropertyId.h:40
SourceXtractor
Definition: Aperture.h:30
AperturePhotometryTask.h
std::map::at
T at(T... args)
MagnitudeConfig.h
MeasurementImageConfig.h
AperturePhotometryTaskFactory.h
SourceXtractor::AperturePhotometry
Aperture photometry fluxes and magnitudes.
Definition: AperturePhotometry.h:38
SourceXtractor::AperturePhotometryTaskFactory::m_aperture_config
std::map< unsigned, std::vector< float > > m_aperture_config
Definition: AperturePhotometryTaskFactory.h:68
AperturePhotometry.h
SourceXtractor::AperturePhotometryArray
Merges all AperturePhotometries into a multidimensional property.
Definition: AperturePhotometryArray.h:40
std::vector::emplace_back
T emplace_back(T... args)
SourceXtractor::PropertyId::getIndex
unsigned int getIndex() const
Definition: PropertyId.h:70
std::vector::begin
T begin(T... args)
SourceXtractor::AperturePhotometryConfig
Definition: AperturePhotometryConfig.h:29
SourceXtractor::AperturePhotometryTaskFactory::m_magnitude_zero_point
SeFloat m_magnitude_zero_point
Definition: AperturePhotometryTaskFactory.h:64
ApertureFlag.h
std::make_pair
T make_pair(T... args)
std::vector::end
T end(T... args)
SourceXtractor::AperturePhotometryTaskFactory::m_col_prefix
std::map< unsigned, std::string > m_col_prefix
Definition: AperturePhotometryTaskFactory.h:72
SourceXtractor::OutputRegistry::registerPropertyInstances
void registerPropertyInstances(const std::vector< std::pair< std::string, unsigned int >> &instance_names)
Definition: OutputRegistry.h:63
SourceXtractor::AperturePhotometryTaskFactory::m_apertures_per_output
std::map< unsigned, std::vector< unsigned > > m_apertures_per_output
Definition: AperturePhotometryTaskFactory.h:73
AperturePhotometryConfig.h
SourceXtractor::AperturePhotometryTaskFactory::registerPropertyInstances
void registerPropertyInstances(OutputRegistry &) override
Definition: AperturePhotometryTaskFactory.cpp:64