SourceXtractorPlusPlus  0.8
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
25 
29 
31 
32 namespace SourceXtractor {
33 
35  const auto& detection_frame = source.getProperty<DetectionFrame>();
36  const auto& pixel_values = source.getProperty<DetectionFramePixelValues>().getValues();
37  const auto& pixel_variances = source.getProperty<DetectionFramePixelValues>().getVariances();
38 
39  SeFloat total_flux = 0.0;
40  SeFloat total_variance = 0.0;
41 
42  auto variance_iter = pixel_variances.begin();
43  for (auto value : pixel_values) {
44  auto variance = *variance_iter++;
45 
46  total_flux += value;
47  total_variance += variance;
48  }
49 
50  // Add variance from gain
51  SeFloat gain = detection_frame.getFrame()->getGain();
52  if (gain >0.0)
53  total_variance += total_flux / gain;
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 
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
SeFloat32 SeFloat
Definition: Types.h:32
T log10(T...args)
The values of a Source&#39;s pixels in the detection image. They are returned as a vector in the same ord...
T quiet_NaN(T...args)
T sqrt(T...args)
The SourceInterface is an abstract &quot;source&quot; that has properties attached to it.
virtual void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.