SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
PythonConfig
ObjectInfo.cpp
Go to the documentation of this file.
1
17
/*
18
* @file ObjectInfo.cpp
19
* @author Nikolaos Apostolakos <nikoapos@gmail.com>
20
*/
21
22
#include <
SEImplementation/PythonConfig/ObjectInfo.h
>
23
#include <
SEImplementation/Plugin/WorldCentroid/WorldCentroid.h
>
24
#include <
SEImplementation/Plugin/ReferenceCoordinates/ReferenceCoordinates.h
>
25
#include <
SEImplementation/Plugin/IsophotalFlux/IsophotalFlux.h
>
26
#include <
SEImplementation/Plugin/ShapeParameters/ShapeParameters.h
>
27
#include <
SEImplementation/Plugin/AssocMode/AssocMode.h
>
28
29
namespace
SourceXtractor
{
30
31
ObjectInfo::ObjectInfo
(
const
AssocModeConfig
& config) {
32
33
emplace
(
std::make_pair
(
"centroid_x"
, 0.));
34
emplace
(
std::make_pair
(
"centroid_y"
, 0.));
35
emplace
(
std::make_pair
(
"isophotal_flux"
, 0.));
36
emplace
(
std::make_pair
(
"radius"
, 0.));
37
emplace
(
std::make_pair
(
"angle"
, 0.));
38
emplace
(
std::make_pair
(
"aspect_ratio"
, 0.));
39
emplace
(
std::make_pair
(
"assoc_match"
,
false
));
40
emplace
(
std::make_pair
(
"assoc_size"
, 0.));
41
for
(
int
i
=0;
i
<100;
i
++) {
42
std::stringstream
label
;
43
label
<<
"assoc_value_"
<<
i
;
44
emplace
(
std::make_pair
(
label
.str(), 0.));
45
}
46
47
for
(
auto
name : config.
getColumnsNames
()) {
48
std::stringstream
label
;
49
label
<<
"assoc_"
<< name;
50
emplace
(
std::make_pair
(
label
.str(), 0.));
51
}
52
}
53
54
ObjectInfo::ObjectInfo
(
const
SourceInterface
&
source
,
const
AssocModeConfig
& config) {
55
auto
world_centroid
=
source
.getProperty<
WorldCentroid
>().getCentroid();
56
auto
reference_coordinates
=
source
.getProperty<
ReferenceCoordinates
>().getCoordinateSystem();
57
auto
centroid
=
reference_coordinates
->worldToImage(
world_centroid
);
58
59
emplace
(
std::make_pair
(
"centroid_x"
,
centroid
.m_x + 1.0));
60
emplace
(
std::make_pair
(
"centroid_y"
,
centroid
.m_y + 1.0));
61
62
try
{
63
auto
iso_flux
=
source
.getProperty<
IsophotalFlux
>();
64
emplace
(
std::make_pair
(
"isophotal_flux"
,
std::max<double>
(
iso_flux
.getFlux(), 0.0001)));
65
}
catch
(
PropertyNotFoundException
&) {
66
}
67
68
try
{
69
auto
shape =
source
.getProperty<
ShapeParameters
>();
70
double
aspect_guess
=
std::max<double>
(shape.getEllipseB() / shape.getEllipseA(), 0.01);
71
72
emplace
(
std::make_pair
(
"radius"
,
std::max<double>
(shape.getEllipseA() / 2.0, 0.01)));
73
emplace
(
std::make_pair
(
"angle"
, shape.getEllipseTheta()));
74
emplace
(
std::make_pair
(
"aspect_ratio"
,
aspect_guess
));
75
}
catch
(
PropertyNotFoundException
&) {
76
}
77
78
auto
assoc
=
source
.getProperty<
AssocMode
>();
79
emplace
(
std::make_pair
(
"assoc_match"
,
assoc
.getMatch()));
80
if
(
assoc
.getMatch()) {
81
emplace
(
std::make_pair
(
"assoc_size"
, (
double
)
assoc
.getAssocValues().shape()[0]));
82
int
i
=0;
83
for
(
auto
assoc_value
:
assoc
.getAssocValues()) {
84
std::stringstream
label
;
85
label
<<
"assoc_value_"
<<
i
;
86
emplace
(
std::make_pair
(
label
.str(),
assoc_value
));
87
88
if
(config.
getColumnsNames
().
size
() > 0) {
89
std::stringstream
labelNamed
;
90
labelNamed
<<
"assoc_"
<< config.
getColumnsNames
().
at
(
i
);
91
emplace
(
std::make_pair
(
labelNamed
.str(),
assoc_value
));
92
}
93
94
i
++;
95
}
96
}
97
}
98
99
}
AssocMode.h
IsophotalFlux.h
ObjectInfo.h
ReferenceCoordinates.h
ShapeParameters.h
WorldCentroid.h
std::vector::at
T at(T... args)
std::stringstream
SourceXtractor::AssocModeConfig
Definition
AssocModeConfig.h:31
SourceXtractor::AssocModeConfig::getColumnsNames
std::vector< std::string > getColumnsNames() const
Definition
AssocModeConfig.h:89
SourceXtractor::AssocMode
Definition
AssocMode.h:33
SourceXtractor::IsophotalFlux
Computes the isophotal flux and magnitude.
Definition
IsophotalFlux.h:36
SourceXtractor::ObjectInfo::ObjectInfo
ObjectInfo(const AssocModeConfig &config)
Definition
ObjectInfo.cpp:31
SourceXtractor::PropertyNotFoundException
An exception indicating that a Property was not available and could not be computed on demand.
Definition
PropertyNotFoundException.h:36
SourceXtractor::ReferenceCoordinates
Definition
ReferenceCoordinates.h:26
SourceXtractor::ShapeParameters
Definition
ShapeParameters.h:32
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition
SourceInterface.h:46
SourceXtractor::WorldCentroid
Definition
WorldCentroid.h:33
std::map< std::string, Attribute >::emplace
Attribute emplace(Attribute ... args)
std::function
std::make_pair
T make_pair(T... args)
SourceXtractor
Definition
Aperture.h:30
std::vector::size
T size(T... args)
Generated by
1.10.0