SourceXtractorPlusPlus
1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
Psf
PsfTaskFactory.cpp
Go to the documentation of this file.
1
17
/*
18
* PsfTaskFactory.h
19
*
20
* Created on: Jun 25, 2018
21
* Author: Alejandro Álvarez Ayllón
22
*/
23
24
#include "
SEImplementation/Configuration/MeasurementImageConfig.h
"
25
#include "
SEImplementation/Plugin/Psf/PsfTaskFactory.h
"
26
27
namespace
SourceXtractor
{
28
29
void
PsfTaskFactory::reportConfigDependencies
(
Euclid::Configuration::ConfigManager
& manager)
const
{
30
manager.
registerConfiguration
<
PsfPluginConfig
>();
31
manager.
registerConfiguration
<
MeasurementImageConfig
>();
32
}
33
34
void
PsfTaskFactory::configure
(
Euclid::Configuration::ConfigManager
& manager) {
35
auto
psf_config = manager.
getConfiguration
<
PsfPluginConfig
>();
36
auto
measurement_config = manager.
getConfiguration
<
MeasurementImageConfig
>();
37
38
const
auto
& default_psf = psf_config.getPsf();
39
const
auto
& image_infos = manager.
getConfiguration
<
MeasurementImageConfig
>().getImageInfos();
40
41
for
(
unsigned
int
i = 0; i < image_infos.size(); i++) {
42
if
(!image_infos[i].m_psf_path.empty()) {
43
m_vpsf
[image_infos[i].m_id] =
PsfPluginConfig::readPsf
(image_infos[i].m_psf_path, image_infos[i].m_psf_hdu);
44
}
45
else
if
(default_psf) {
46
m_vpsf
[image_infos[i].m_id] = default_psf;
47
}
48
}
49
}
50
51
std::shared_ptr<Task>
PsfTaskFactory::createTask
(
const
SourceXtractor::PropertyId
& property_id)
const
{
52
auto
instance = property_id.
getIndex
();
53
54
if
(
m_vpsf
.find(instance) ==
m_vpsf
.end()) {
55
throw
Elements::Exception
() <<
"Missing PSF. Make sure every frame has a PSF"
;
56
}
57
58
try
{
59
return
std::make_shared<PsfTask>
(instance,
m_vpsf
.at(instance));
60
}
catch
(
const
std::out_of_range
&) {
61
return
nullptr
;
62
}
63
}
64
65
}
// end SourceXtractor
MeasurementImageConfig.h
PsfTaskFactory.h
Elements::Exception
Euclid::Configuration::ConfigManager
Euclid::Configuration::ConfigManager::registerConfiguration
void registerConfiguration()
Euclid::Configuration::ConfigManager::getConfiguration
T & getConfiguration()
SourceXtractor::MeasurementImageConfig
Definition
MeasurementImageConfig.h:37
SourceXtractor::PropertyId
Identifier used to set and retrieve properties.
Definition
PropertyId.h:40
SourceXtractor::PropertyId::getIndex
unsigned int getIndex() const
Definition
PropertyId.h:70
SourceXtractor::PsfPluginConfig
Definition
PsfPluginConfig.h:32
SourceXtractor::PsfPluginConfig::readPsf
static std::shared_ptr< Psf > readPsf(const std::string &filename, int hdu_number=1)
Definition
PsfPluginConfig.cpp:164
SourceXtractor::PsfTaskFactory::m_vpsf
std::map< int, std::shared_ptr< Psf > > m_vpsf
Definition
PsfTaskFactory.h:46
SourceXtractor::PsfTaskFactory::createTask
std::shared_ptr< Task > createTask(const PropertyId &property_id) const override
Returns a Task producing a Property corresponding to the given PropertyId.
Definition
PsfTaskFactory.cpp:51
SourceXtractor::PsfTaskFactory::reportConfigDependencies
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition
PsfTaskFactory.cpp:29
SourceXtractor::PsfTaskFactory::configure
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition
PsfTaskFactory.cpp:34
std::make_shared
T make_shared(T... args)
SourceXtractor
Definition
Aperture.h:30
std::out_of_range
std::shared_ptr
Generated by
1.14.0