SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
AutoPhotometry
AutoPhotometryTask.cpp
Go to the documentation of this file.
1
17
/*
18
* AutoPhotometryTask.cpp
19
*
20
* Created on: Jul 18, 2016
21
* Author: mkuemmel@usm.lmu.de
22
*/
23
24
#include "
SEFramework/Aperture/EllipticalAperture.h
"
25
#include "
SEFramework/Aperture/TransformedAperture.h
"
26
#include "
SEFramework/Source/SourceFlags.h
"
27
#include "
SEFramework/Aperture/FluxMeasurement.h
"
28
29
#include "
SEImplementation/CheckImages/CheckImages.h
"
30
#include "
SEImplementation/Plugin/BlendedFlag/BlendedFlag.h
"
31
#include "
SEImplementation/Plugin/SaturateFlag/SaturateFlag.h
"
32
#include "
SEImplementation/Plugin/AutoPhotometry/AutoPhotometryFlag.h
"
33
#include <
SEImplementation/Plugin/MeasurementFrameInfo/MeasurementFrameInfo.h
>
34
#include <
SEImplementation/Plugin/MeasurementFrameImages/MeasurementFrameImages.h
>
35
#include "
SEImplementation/Plugin/MeasurementFramePixelCentroid/MeasurementFramePixelCentroid.h
"
36
#include "
SEImplementation/Plugin/ShapeParameters/ShapeParameters.h
"
37
#include "
SEImplementation/Plugin/KronRadius/KronRadius.h
"
38
#include "
SEImplementation/Plugin/Jacobian/Jacobian.h
"
39
#include "
SEImplementation/Plugin/SourceIDs/SourceID.h
"
40
#include "
SEImplementation/Plugin/AutoPhotometry/AutoPhotometry.h
"
41
#include "
SEImplementation/Plugin/AutoPhotometry/AutoPhotometryTask.h
"
42
43
44
namespace
SourceXtractor
{
45
47
48
void
AutoPhotometryTask::computeProperties
(
SourceInterface
&
source
)
const
{
49
const
auto
&
measurement_frame_info
=
source
.getProperty<
MeasurementFrameInfo
>(
m_instance
);
50
const
auto
&
measurement_frame_images
=
source
.getProperty<
MeasurementFrameImages
>(
m_instance
);
51
52
auto
variance_threshold
=
measurement_frame_info
.getVarianceThreshold();
53
auto
gain =
measurement_frame_info
.getGain();
54
55
const
auto
measurement_image
=
measurement_frame_images
.getLockedImage(
LayerSubtractedImage
);
56
const
auto
variance_map
=
measurement_frame_images
.getLockedImage(
LayerVarianceMap
);
57
58
// get the object center
59
const
auto
&
centroid_x
=
source
.getProperty<
MeasurementFramePixelCentroid
>(
m_instance
).getCentroidX();
60
const
auto
&
centroid_y
=
source
.getProperty<
MeasurementFramePixelCentroid
>(
m_instance
).getCentroidY();
61
62
// get the shape parameters
63
const
auto
&
cxx
=
source
.getProperty<
ShapeParameters
>().getEllipseCxx();
64
const
auto
&
cyy
=
source
.getProperty<
ShapeParameters
>().getEllipseCyy();
65
const
auto
&
cxy
=
source
.getProperty<
ShapeParameters
>().getEllipseCxy();
66
67
// get the jacobian
68
const
auto
&
jacobian
=
source
.getProperty<
JacobianSource
>(
m_instance
);
69
70
// get the kron-radius
71
SeFloat
kron_radius_auto
=
m_kron_factor
*
source
.getProperty<
KronRadius
>().getKronRadius();
72
if
(
kron_radius_auto
<
m_kron_minrad
)
73
kron_radius_auto
=
m_kron_minrad
;
74
75
// create the elliptical aperture
76
auto
ell_aper
=
std::make_shared<TransformedAperture>
(
77
std::make_shared<EllipticalAperture>
(
cxx
,
cyy
,
cxy
,
kron_radius_auto
),
78
jacobian
.asTuple());
79
80
auto
measurement
=
measureFlux
(
ell_aper
,
centroid_x
,
centroid_y
,
measurement_image
,
variance_map
,
variance_threshold
,
81
m_use_symmetry
);
82
83
// compute the derived quantities
84
auto
total_variance
=
measurement
.m_variance;
85
if
(gain >0.0)
86
total_variance
+=
measurement
.m_flux / gain;
87
auto
flux_error
=
sqrt
(
total_variance
);
88
auto
mag
=
measurement
.m_flux > 0.0 ? -2.5 *
log10
(
measurement
.m_flux) +
m_magnitude_zero_point
:
std::numeric_limits<SeFloat>::quiet_NaN
();
89
auto
mag_error
= 1.0857 *
flux_error
/
measurement
.m_flux;
90
91
// Add the flags from the detection image and from the saturated and blended plugins
92
measurement
.m_flags |=
source
.getProperty<
AutoPhotometryFlag
>().getFlags();
93
measurement
.m_flags |=
Flags::SATURATED
*
source
.getProperty<
SaturateFlag
>(
m_instance
).getSaturateFlag();
94
measurement
.m_flags |=
Flags::BLENDED
*
source
.getProperty<
BlendedFlag
>().getBlendedFlag();
95
96
// set the source properties
97
source
.setIndexedProperty<
AutoPhotometry
>(
m_instance
,
measurement
.m_flux,
flux_error
,
mag
,
mag_error
,
measurement
.m_flags);
98
99
// Draw the aperture
100
auto
aperture_check_img
=
CheckImages::getInstance
().getMeasurementAutoApertureImage(
m_instance
);
101
if
(
aperture_check_img
) {
102
auto
src_id
=
source
.getProperty<
SourceID
>().getId();
103
104
drawAperture<int>
(
ell_aper
,
centroid_x
,
centroid_y
,
aperture_check_img
,
static_cast<
unsigned
>
(
src_id
));
105
}
106
}
107
108
}
AutoPhotometryFlag.h
AutoPhotometryTask.h
AutoPhotometry.h
BlendedFlag.h
CheckImages.h
EllipticalAperture.h
FluxMeasurement.h
Jacobian.h
KronRadius.h
MeasurementFrameImages.h
MeasurementFrameInfo.h
MeasurementFramePixelCentroid.h
SourceFlags.h
SaturateFlag.h
ShapeParameters.h
SourceID.h
TransformedAperture.h
SourceXtractor::AutoPhotometryFlag
Definition
AutoPhotometryFlag.h:34
SourceXtractor::AutoPhotometryTask::m_use_symmetry
bool m_use_symmetry
Definition
AutoPhotometryTask.h:52
SourceXtractor::AutoPhotometryTask::m_kron_factor
SeFloat m_kron_factor
Definition
AutoPhotometryTask.h:50
SourceXtractor::AutoPhotometryTask::m_instance
unsigned m_instance
Definition
AutoPhotometryTask.h:48
SourceXtractor::AutoPhotometryTask::m_magnitude_zero_point
SeFloat m_magnitude_zero_point
Definition
AutoPhotometryTask.h:49
SourceXtractor::AutoPhotometryTask::m_kron_minrad
SeFloat m_kron_minrad
Definition
AutoPhotometryTask.h:51
SourceXtractor::AutoPhotometryTask::computeProperties
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Definition
AutoPhotometryTask.cpp:48
SourceXtractor::AutoPhotometry
Auto photometry flux and magnitude.
Definition
AutoPhotometry.h:37
SourceXtractor::BlendedFlag
Definition
BlendedFlag.h:31
SourceXtractor::CheckImages::getInstance
static CheckImages & getInstance()
Definition
CheckImages.h:158
SourceXtractor::JacobianSource
Definition
Jacobian.h:51
SourceXtractor::KronRadius
Kron radius.
Definition
KronRadius.h:36
SourceXtractor::MeasurementFrameImages
Definition
MeasurementFrameImages.h:31
SourceXtractor::MeasurementFrameInfo
Definition
MeasurementFrameInfo.h:28
SourceXtractor::MeasurementFramePixelCentroid
Definition
MeasurementFramePixelCentroid.h:31
SourceXtractor::SaturateFlag
Definition
SaturateFlag.h:46
SourceXtractor::ShapeParameters
Definition
ShapeParameters.h:32
SourceXtractor::SourceID
Definition
SourceID.h:33
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition
SourceInterface.h:46
std::function
std::log10
T log10(T... args)
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::Flags::BLENDED
@ BLENDED
The object was originally blended with another one.
SourceXtractor::Flags::SATURATED
@ SATURATED
At least one pixel of the object is saturated.
SourceXtractor::LayerVarianceMap
@ LayerVarianceMap
Definition
Frame.h:45
SourceXtractor::LayerSubtractedImage
@ LayerSubtractedImage
Definition
Frame.h:39
SourceXtractor::measureFlux
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)
Definition
FluxMeasurement.cpp:51
std::numeric_limits::quiet_NaN
T quiet_NaN(T... args)
std::sqrt
T sqrt(T... args)
Generated by
1.10.0