SourceXtractorPlusPlus  0.16
Please provide a description of the project.
IsophotalFluxTask.cpp
Go to the documentation of this file.
1 
17 /*
18  * IsophotalTask.cpp
19  *
20  * Created on: Sep 28, 2016
21  * Author: mschefer
22  */
23 
28 
30 
31 namespace SourceXtractor {
32 
34  const auto& detection_frame_info = source.getProperty<DetectionFrameInfo>();
35  const auto& pixel_values = source.getProperty<DetectionFramePixelValues>().getValues();
36  const auto& pixel_variances = source.getProperty<DetectionFramePixelValues>().getVariances();
37 
38  SeFloat total_flux = 0.0;
39  SeFloat total_variance = 0.0;
40 
41  auto variance_iter = pixel_variances.begin();
42  for (auto value : pixel_values) {
43  auto variance = *variance_iter++;
44 
45  total_flux += value;
46  total_variance += variance;
47  }
48 
49  // Add variance from gain
50  SeFloat gain = detection_frame_info.getGain();
51  if (gain > 0.0) {
52  total_variance += total_flux / gain;
53  }
54 
55  auto flux_error = sqrt(total_variance);
56 
57  auto mag = total_flux > 0.0 ? -2.5*log10(total_flux) + m_magnitude_zero_point : std::numeric_limits<SeFloat>::quiet_NaN();
58  auto mag_error = 1.0857 * flux_error / total_flux;
59 
60  source.setProperty<IsophotalFlux>(total_flux, flux_error, mag, mag_error);
61 }
62 
63 }
64 
65 
The values of a Source's pixels in the detection image. They are returned as a vector in the same ord...
virtual void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Computes the isophotal flux and magnitude.
Definition: IsophotalFlux.h:36
The SourceInterface is an abstract "source" that has properties attached to it.
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
T log10(T... args)
SeFloat32 SeFloat
Definition: Types.h:32
T quiet_NaN(T... args)
T sqrt(T... args)