SourceXtractorPlusPlus  0.10
Please provide a description of the project.
MoffatCriteria.cpp
Go to the documentation of this file.
1 
17 /*
18  * MoffatCriteria.cpp
19  *
20  * Created on: 2019 M01 25
21  * Author: mschefer
22  */
23 
27 
30 
31 namespace SourceXtractor {
32 
33 using namespace ModelFitting;
34 
35 bool MoffatCriteria::doesImpact(const SourceInterface& impactor, const SourceInterface& impactee) const {
36  auto& extended_model = impactor.getProperty<MoffatModelEvaluator>();
37  if (extended_model.getIterations() == 0) {
38  return false;
39  }
40 
41  auto& centroid = impactee.getProperty<PixelCentroid>();
42  auto& other_centroid = impactor.getProperty<PixelCentroid>();
43 
44  auto dx = centroid.getCentroidX() - other_centroid.getCentroidX();
45  auto dy = centroid.getCentroidY() - other_centroid.getCentroidY();
46  if (dx*dx + dy*dy > m_max_distance * m_max_distance ) {
47  return false;
48  }
49 
50  auto max_value = impactee.getProperty<PeakValue>().getMaxValue();
51 
52  double model_value = extended_model.getValue(centroid.getCentroidX(), centroid.getCentroidY());
53 
54  return (model_value / max_value) > m_threshold;
55 }
56 
57 bool MoffatCriteria::shouldGroup(const SourceInterface& first, const SourceInterface& second) const {
58 // auto& first_moffat_model = first.getProperty<MoffatModelFitting>();
59 // auto& second_moffat_model = second.getProperty<MoffatModelFitting>();
60 
61  return doesImpact(first, second) || doesImpact(second, first);
62 }
63 
64 } // SourceXtractor namespace
65 
66 
constexpr double second
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values.
Definition: PixelCentroid.h:37
SeFloat getCentroidX() const
X coordinate of centroid.
Definition: PixelCentroid.h:48
std::shared_ptr< EngineParameter > dx
virtual bool shouldGroup(const SourceInterface &, const SourceInterface &) const override
Determines if the two sources should be grouped together.
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
SeFloat getCentroidY() const
Y coordinate of centroid.
Definition: PixelCentroid.h:53
bool doesImpact(const SourceInterface &impactor, const SourceInterface &impactee) const
The SourceInterface is an abstract "source" that has properties attached to it.
std::shared_ptr< EngineParameter > dy