SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
AperturePhotometryTask.cpp
Go to the documentation of this file.
1
17/*
18 * AperturePhotometryTask.cpp
19 *
20 * Created on: Sep 22, 2016
21 * Author: mschefer
22 */
23
28
30
38
41
43
44namespace SourceXtractor {
45
47
51
52 auto variance_threshold = measurement_frame_info.getVarianceThreshold();
53 auto gain = measurement_frame_info.getGain();
54
56 const auto variance_map = measurement_frame_images.getLockedImage(LayerVarianceMap);
57
59
60 // get the object center
61 const auto& centroid_x = source.getProperty<MeasurementFramePixelCentroid>(m_instance).getCentroidX();
62 const auto& centroid_y = source.getProperty<MeasurementFramePixelCentroid>(m_instance).getCentroidY();
63
64 // m_apertures is the aperture on the detection frame, so we have to wrap it
65 // to transform it to the measurement frame
66 auto jacobian = source.getProperty<JacobianSource>(m_instance);
67
71
72 for (auto aperture_diameter : m_apertures) {
75 jacobian.asTuple()
76 );
77
80 // compute the derived quantities
81 if (gain > 0) {
82 measurement.m_variance += measurement.m_flux / gain;
83 }
84 auto flux_error = sqrt(measurement.m_variance);
86 auto mag_error = 1.0857 * flux_error / measurement.m_flux;
87
88 fluxes.push_back(measurement.m_flux);
89 fluxes_error.push_back(flux_error);
90 mags.push_back(mag);
91 mags_error.push_back(mag_error);
92 flags.push_back(measurement.m_flags);
93 }
94
95 // Merge flags with those set on the detection frame and from the saturate and blended plugins
97 additional_flags |= Flags::SATURATED * source.getProperty<SaturateFlag>(m_instance).getSaturateFlag();
98 additional_flags |= Flags::BLENDED * source.getProperty<BlendedFlag>().getBlendedFlag();
99
100 auto aperture_flags = source.getProperty<ApertureFlag>().getFlags();
101 for (size_t i = 0; i < m_apertures.size(); ++i) {
103 flags[i] |= additional_flags | det_flag;
104 }
105
106 // set the source properties
107 source.setIndexedProperty<AperturePhotometry>(m_instance, fluxes, fluxes_error, mags, mags_error, flags);
108
109 // draw the apertures onto the checkimage
110 auto aperture_check_img = CheckImages::getInstance().getMeasurementApertureImage(m_instance);
111 if (aperture_check_img) {
112 auto src_id = source.getProperty<SourceID>().getId();
113 for (auto aperture_diameter : m_apertures) {
115 jacobian.asTuple());
117 }
118
119 }
120}
121
122}
123
Aperture photometry flag.
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Aperture photometry fluxes and magnitudes.
static CheckImages & getInstance()
The SourceInterface is an abstract "source" that has properties attached to it.
T log10(T... args)
Flags
Flagging of bad sources.
Definition SourceFlags.h:37
@ BLENDED
The object was originally blended with another one.
@ SATURATED
At least one pixel of the object is saturated.
@ NONE
No flag is set.
@ LayerVarianceMap
Definition Frame.h:45
@ LayerSubtractedImage
Definition Frame.h:39
FluxMeasurement measureFlux(const std::shared_ptr< Aperture > &aperture, SeFloat centroid_x, SeFloat centroid_y, const std::shared_ptr< Image< SeFloat > > &img, const std::shared_ptr< Image< SeFloat > > &variance_map, SeFloat variance_threshold, bool use_symmetry)
T quiet_NaN(T... args)
T size(T... args)
T sqrt(T... args)