SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
ObjectInfo.cpp
Go to the documentation of this file.
1
17/*
18 * @file ObjectInfo.cpp
19 * @author Nikolaos Apostolakos <nikoapos@gmail.com>
20 */
21
28
29namespace SourceXtractor {
30
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++) {
43 label << "assoc_value_" << i;
44 emplace(std::make_pair(label.str(), 0.));
45 }
46
47 for (auto name : config.getColumnsNames()) {
49 label << "assoc_" << name;
50 emplace(std::make_pair(label.str(), 0.));
51 }
52}
53
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()) {
85 label << "assoc_value_" << i;
87
88 if (config.getColumnsNames().size() > 0) {
90 labelNamed << "assoc_" << config.getColumnsNames().at(i);
92 }
93
94 i++;
95 }
96 }
97}
98
99}
T at(T... args)
std::vector< std::string > getColumnsNames() const
Computes the isophotal flux and magnitude.
ObjectInfo(const AssocModeConfig &config)
An exception indicating that a Property was not available and could not be computed on demand.
The SourceInterface is an abstract "source" that has properties attached to it.
Attribute emplace(Attribute ... args)
T make_pair(T... args)
T size(T... args)