SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEFramework
SEFramework
Aperture
FluxMeasurement.h
Go to the documentation of this file.
1
17
/*
18
* FluxMeasurement.h
19
*
20
* Created on: Oct 19, 2018
21
* Author: Alejandro Alvarez
22
*/
23
24
#ifndef _SEFRAMEWORK_SEFRAMEWORK_APERTURE_MEASUREFLUX_H
25
#define _SEFRAMEWORK_SEFRAMEWORK_APERTURE_MEASUREFLUX_H
26
27
#include "
Aperture.h
"
28
#include "
SEFramework/Image/WriteableImage.h
"
29
#include "
SEFramework/Source/SourceFlags.h
"
30
31
namespace
SourceXtractor
{
32
33
struct
FluxMeasurement
{
34
SeFloat
m_flux
;
35
SeFloat
m_variance
;
36
SeFloat
m_total_area
,
m_bad_area
;
37
Flags
m_flags
;
38
39
FluxMeasurement
() :
m_flux
(0.),
m_variance
(0.),
m_total_area
(0.),
m_bad_area
(0.),
m_flags
(
Flags
::
NONE
) {}
40
};
41
61
FluxMeasurement
measureFlux
(
const
std::shared_ptr<Aperture>
&aperture,
SeFloat
centroid_x,
SeFloat
centroid_y,
62
const
std::shared_ptr
<Image<SeFloat>> &img,
63
const
std::shared_ptr
<Image<SeFloat>> &variance_map,
SeFloat
variance_threshold,
64
bool
use_symmetry);
65
80
template
<
typename
T>
81
void
fillAperture
(
const
std::shared_ptr<Aperture>
&
aperture
,
SeFloat
centroid_x
,
SeFloat
centroid_y
,
82
const
std::shared_ptr
<
WriteableImage<T>
> &
img
, T value) {
83
auto
min_pixel
=
aperture
->getMinPixel(
centroid_x
,
centroid_y
);
84
auto
max_pixel
=
aperture
->getMaxPixel(
centroid_x
,
centroid_y
);
85
86
for
(
int
y
=
min_pixel
.m_y;
y
<=
max_pixel
.m_y; ++
y
) {
87
for
(
int
x
=
min_pixel
.m_x;
x
<=
max_pixel
.m_x; ++
x
) {
88
if
(
aperture
->getArea(
centroid_x
,
centroid_y
,
x
,
y
) > 0) {
89
if
(
x
>= 0 &&
y
>= 0 &&
x < img->
getWidth() &&
y
<
img
->getHeight()) {
90
img
->setValue(
x
,
y
, value);
91
}
92
}
93
}
94
}
95
}
96
111
template
<
typename
T>
112
void
drawAperture
(
const
std::shared_ptr<Aperture>
&
aperture
,
SeFloat
centroid_x
,
SeFloat
centroid_y
,
113
const
std::shared_ptr
<
WriteableImage<T>
> &
img
, T value) {
114
auto
min_pixel
=
aperture
->getMinPixel(
centroid_x
,
centroid_y
);
115
auto
max_pixel
=
aperture
->getMaxPixel(
centroid_x
,
centroid_y
);
116
117
for
(
int
y
=
min_pixel
.m_y;
y
<=
max_pixel
.m_y; ++
y
) {
118
for
(
int
x
=
min_pixel
.m_x;
x
<=
max_pixel
.m_x; ++
x
) {
119
if
(
aperture
->drawArea(
centroid_x
,
centroid_y
,
x
,
y
) > 0) {
120
if
(
x
>= 0 &&
y
>= 0 &&
x < img->
getWidth() &&
y
<
img
->getHeight()) {
121
img
->setValue(
x
,
y
, value);
122
}
123
}
124
}
125
}
126
}
127
128
}
// end SourceXtractor
129
130
#endif
// _SEFRAMEWORK_SEFRAMEWORK_APERTURE_MEASUREFLUX_H
Aperture.h
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition
MoffatModelFittingTask.cpp:94
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition
MoffatModelFittingTask.cpp:94
SourceFlags.h
WriteableImage.h
std::function
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::Flags
Flags
Flagging of bad sources.
Definition
SourceFlags.h:37
SourceXtractor::Flags::NONE
@ NONE
No flag is set.
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition
Types.h:32
SourceXtractor::fillAperture
void fillAperture(const std::shared_ptr< Aperture > &aperture, SeFloat centroid_x, SeFloat centroid_y, const std::shared_ptr< WriteableImage< T > > &img, T value)
Definition
FluxMeasurement.h:81
SourceXtractor::drawAperture
void drawAperture(const std::shared_ptr< Aperture > &aperture, SeFloat centroid_x, SeFloat centroid_y, const std::shared_ptr< WriteableImage< T > > &img, T value)
Definition
FluxMeasurement.h:112
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::shared_ptr
SourceXtractor::FluxMeasurement
Definition
FluxMeasurement.h:33
SourceXtractor::FluxMeasurement::m_variance
SeFloat m_variance
Definition
FluxMeasurement.h:35
SourceXtractor::FluxMeasurement::m_flags
Flags m_flags
Definition
FluxMeasurement.h:37
SourceXtractor::FluxMeasurement::m_total_area
SeFloat m_total_area
Definition
FluxMeasurement.h:36
SourceXtractor::FluxMeasurement::FluxMeasurement
FluxMeasurement()
Definition
FluxMeasurement.h:39
SourceXtractor::FluxMeasurement::m_flux
SeFloat m_flux
Definition
FluxMeasurement.h:34
SourceXtractor::FluxMeasurement::m_bad_area
SeFloat m_bad_area
Definition
FluxMeasurement.h:36
Generated by
1.10.0