SourceXtractorPlusPlus
0.15
Please provide a description of the project.
SEFramework
src
lib
Aperture
EllipticalAperture.cpp
Go to the documentation of this file.
1
17
/*
18
* EllipticalAperture.cpp
19
*
20
* Created on: Oct 08, 2018
21
* Author: Alejandro Alvarez
22
*/
23
24
#include "
SEFramework/Aperture/EllipticalAperture.h
"
25
26
namespace
SourceXtractor
{
27
28
29
EllipticalAperture::EllipticalAperture
(
SeFloat
cxx,
SeFloat
cyy,
SeFloat
cxy,
30
SeFloat
rad_max)
31
: m_cxx{cxx}, m_cyy{cyy}, m_cxy{cxy}, m_rad_max{rad_max} {
32
}
33
34
SeFloat
EllipticalAperture::getArea
(
SeFloat
center_x,
SeFloat
center_y,
SeFloat
pixel_x,
SeFloat
pixel_y)
const
{
35
if
(
getRadiusSquared
(center_x, center_y, pixel_x, pixel_y) <
m_rad_max
*
m_rad_max
) {
36
return
1.0;
37
}
38
return
0.;
39
}
40
41
SeFloat
EllipticalAperture::getRadiusSquared
(
SeFloat
center_x,
SeFloat
center_y,
SeFloat
pixel_x,
42
SeFloat
pixel_y)
const
{
43
auto
dist_x =
SeFloat
(pixel_x) - center_x;
44
auto
dist_y =
SeFloat
(pixel_y) - center_y;
45
46
return
m_cxx
* dist_x * dist_x +
m_cyy
* dist_y * dist_y +
m_cxy
* dist_x * dist_y;
47
}
48
49
PixelCoordinate
EllipticalAperture::getMinPixel
(
SeFloat
centroid_x,
SeFloat
centroid_y)
const
{
50
SeFloat
dx
,
dy
;
51
52
// compute the maximum extend in x/y
53
dx
=
m_rad_max
*
std::sqrt
(1.0 / (
m_cxx
-
m_cxy
*
m_cxy
/ (4.0 *
m_cyy
)));
54
dy
=
m_rad_max
*
std::sqrt
(1.0 / (
m_cyy
-
m_cxy
*
m_cxy
/ (4.0 *
m_cxx
)));
55
56
// return the absolute values
57
return
PixelCoordinate
(centroid_x -
dx
, centroid_y -
dy
);
58
}
59
60
PixelCoordinate
EllipticalAperture::getMaxPixel
(
SeFloat
centroid_x,
SeFloat
centroid_y)
const
{
61
SeFloat
dx
,
dy
;
62
63
// compute the maximum extend in x/y
64
dx
=
m_rad_max
*
std::sqrt
(1.0 / (
m_cxx
-
m_cxy
*
m_cxy
/ (4.0 *
m_cyy
)));
65
dy
=
m_rad_max
*
std::sqrt
(1.0 / (
m_cyy
-
m_cxy
*
m_cxy
/ (4.0 *
m_cxx
)));
66
67
// return the absolute values
68
return
PixelCoordinate
(centroid_x +
dx
+ 1, centroid_y +
dy
+ 1);
69
}
70
71
}
// end SourceXtractor
EllipticalAperture.h
dx
std::shared_ptr< EngineParameter > dx
Definition:
MoffatModelFittingTask.cpp:93
dy
std::shared_ptr< EngineParameter > dy
Definition:
MoffatModelFittingTask.cpp:93
SourceXtractor::EllipticalAperture::m_cyy
SeFloat m_cyy
Definition:
EllipticalAperture.h:47
SourceXtractor::EllipticalAperture::getMinPixel
PixelCoordinate getMinPixel(SeFloat centroid_x, SeFloat centroid_y) const override
Definition:
EllipticalAperture.cpp:49
SourceXtractor::EllipticalAperture::getRadiusSquared
SeFloat getRadiusSquared(SeFloat center_x, SeFloat center_y, SeFloat pixel_x, SeFloat pixel_y) const override
Definition:
EllipticalAperture.cpp:41
SourceXtractor::EllipticalAperture::getMaxPixel
PixelCoordinate getMaxPixel(SeFloat centroid_x, SeFloat centroid_y) const override
Definition:
EllipticalAperture.cpp:60
SourceXtractor::EllipticalAperture::m_rad_max
SeFloat m_rad_max
Definition:
EllipticalAperture.h:49
SourceXtractor::EllipticalAperture::m_cxx
SeFloat m_cxx
Definition:
EllipticalAperture.h:46
SourceXtractor::EllipticalAperture::getArea
SeFloat getArea(SeFloat center_x, SeFloat center_y, SeFloat pixel_x, SeFloat pixel_y) const override
Definition:
EllipticalAperture.cpp:34
SourceXtractor::EllipticalAperture::EllipticalAperture
EllipticalAperture(SeFloat cxx, SeFloat cyy, SeFloat cxy, SeFloat rad_max)
Definition:
EllipticalAperture.cpp:29
SourceXtractor::EllipticalAperture::m_cxy
SeFloat m_cxy
Definition:
EllipticalAperture.h:48
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition:
Types.h:32
std::sqrt
T sqrt(T... args)
SourceXtractor::PixelCoordinate
A pixel coordinate made of two integers m_x and m_y.
Definition:
PixelCoordinate.h:37
Generated by
1.9.1