SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
PsfTask.cpp
Go to the documentation of this file.
1
17/*
18 * PsfTask.cpp
19 *
20 * Created on: Jun 25, 2018
21 * Author: Alejandro Alvarez Ayllon
22 */
23
24#include <numeric>
30
31namespace SourceXtractor {
32
35 double top_x = measurement_frame_group.getTopLeft().m_x;
36 return top_x + measurement_frame_group.getWidth() / 2.;
37}
38
41 double top_y = measurement_frame_group.getTopLeft().m_y;
42 return top_y + measurement_frame_group.getHeight() / 2.;
43}
44
46 {"X_IMAGE", getCoordX},
47 {"Y_IMAGE", getCoordY},
48 {"XWIN_IMAGE", getCoordX},
49 {"YWIN_IMAGE", getCoordY},
50 {"XPEAK_IMAGE", getCoordX},
51 {"YPEAK_IMAGE", getCoordY},
52 {"XMODEL_IMAGE", getCoordX},
53 {"YMODEL_IMAGE", getCoordY}
54};
55
57 : m_instance(instance), m_vpsf(vpsf) {
58}
59
61 if (m_vpsf != nullptr) {
63
64 for (auto component : m_vpsf->getComponents()) {
66 }
67
68 auto psf = m_vpsf->getPsf(component_values);
69 // The result may not be normalized!
70 auto psf_sum = std::accumulate(psf->getData().begin(), psf->getData().end(), 0.);
72 group.setIndexedProperty<PsfProperty>(m_instance, m_vpsf->getPixelSampling(), psf_normalized);
73
74 // Check image
75 if (group.size()) {
77 if (check_image) {
78 auto x = component_value_getters["X_IMAGE"](group, m_instance);
79 auto y = component_value_getters["Y_IMAGE"](group, m_instance);
80
82 check_image, psf_normalized, m_vpsf->getPixelSampling(), x, y);
83 }
84 }
85 } else {
86 group.setIndexedProperty<PsfProperty>(m_instance, 1.0, nullptr);
87 }
88}
89
90}
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
T accumulate(T... args)
static CheckImages & getInstance()
std::shared_ptr< Psf > m_vpsf
Definition PsfTask.h:45
PsfTask(unsigned instance, const std::shared_ptr< Psf > &vpsf)
Definition PsfTask.cpp:56
void computeProperties(SourceGroupInterface &source) const override
Computes one or more properties for the SourceGroup and/or the Sources it contains.
Definition PsfTask.cpp:60
static std::map< std::string, ValueGetter > component_value_getters
Definition PsfTask.h:41
Defines the interface used to group sources.
static std::shared_ptr< VectorImage< T > > create(Args &&... args)
static double getCoordX(SourceXtractor::SourceGroupInterface &group, unsigned instance)
Definition PsfTask.cpp:33
static double getCoordY(SourceXtractor::SourceGroupInterface &group, unsigned instance)
Definition PsfTask.cpp:39
static void addImageToImage(ImageType &image1, const ImageType &image2, double scale, double x, double y)