SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ObjectInfo.cpp
Go to the documentation of this file.
1 
17 /*
18  * @file ObjectInfo.cpp
19  * @author Nikolaos Apostolakos <nikoapos@gmail.com>
20  */
21 
27 
28 namespace SourceXtractor {
29 
31  emplace(std::make_pair("centroid_x", 0.));
32  emplace(std::make_pair("centroid_y", 0.));
33  emplace(std::make_pair("isophotal_flux", 0.));
34  emplace(std::make_pair("radius", 0.));
35  emplace(std::make_pair("angle", 0.));
36  emplace(std::make_pair("aspect_ratio", 0.));
37  emplace(std::make_pair("assoc_match", false));
38  emplace(std::make_pair("assoc_size", 0.));
39  for (int i=0; i<100; i++) {
40  std::stringstream label;
41  label << "assoc_value_" << i;
42  emplace(std::make_pair(label.str(), 0.));
43  }
44 }
45 
47  auto centroid = source.getProperty<PixelCentroid>();
48  auto iso_flux = source.getProperty<IsophotalFlux>();
49  auto shape = source.getProperty<ShapeParameters>();
50  auto assoc = source.getProperty<AssocMode>();
51 
52  double aspect_guess = std::max<double>(shape.getEllipseB() / shape.getEllipseA(), 0.01);
53 
54  emplace(std::make_pair("centroid_x", centroid.getCentroidX() + 1.0));
55  emplace(std::make_pair("centroid_y", centroid.getCentroidY() + 1.0));
56  emplace(std::make_pair("isophotal_flux", std::max<double>(iso_flux.getFlux(), 0.0001)));
57  emplace(std::make_pair("radius", std::max<double>(shape.getEllipseA() / 2.0, 0.01)));
58  emplace(std::make_pair("angle", shape.getEllipseTheta()));
59  emplace(std::make_pair("aspect_ratio", aspect_guess));
60 
61  emplace(std::make_pair("assoc_match", assoc.getMatch()));
62  if (assoc.getMatch()) {
63  emplace(std::make_pair("assoc_size", (double) assoc.getAssocValues().shape()[0]));
64  int i=0;
65  for (auto assoc_value : assoc.getAssocValues()) {
66  std::stringstream label;
67  label << "assoc_value_" << i;
68  emplace(std::make_pair(label.str(), assoc_value));
69  i++;
70  }
71 
72  }
73 }
74 
75 }
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
Computes the isophotal flux and magnitude.
Definition: IsophotalFlux.h:36
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values...
Definition: PixelCentroid.h:37
T str(T...args)
T make_pair(T...args)
Attribute emplace(Attribute...args)
The SourceInterface is an abstract &quot;source&quot; that has properties attached to it.