31 #include "../../SourceCatalog/PhotometryParsingException.h"
37 namespace SourceCatalog {
42 const bool missing_photometry_enabled,
const double missing_photometry_flag,
const bool upper_limit_enabled,
44 : m_missing_photometry_enabled(missing_photometry_enabled)
45 , m_missing_photometry_flag(missing_photometry_flag)
46 , m_upper_limit_enabled(upper_limit_enabled)
48 , m_n_upper_limit_flag(n_upper_limit_flag) {
53 for (
auto filter_name_pair : filter_name_mapping) {
54 flux_column_index_ptr = column_info_ptr->
find(filter_name_pair.second.first);
55 error_column_index_ptr = column_info_ptr->
find(filter_name_pair.second.second);
57 if (flux_column_index_ptr ==
nullptr) {
58 throw Elements::Exception() <<
"Column info does not have the flux column " << filter_name_pair.second.first;
60 if (error_column_index_ptr ==
nullptr) {
61 throw Elements::Exception() <<
"Column info does not have the flux error column " << filter_name_pair.second.second;
68 for (
auto a_filter_name_map : filter_name_mapping) {
89 bool missing_data =
false;
90 bool upper_limit =
false;
104 "Zero error encountered when parsing the Photometry with 'missing data' and 'upper limit' enabled", flux, error);
109 error = flux / n_threshod_iter->second;
114 "Negative or Zero flux encountered when parsing the Photometry in the context of an 'upper limit'", flux, error);
117 error = std::abs(error);
123 "Negative or Zero error encountered when parsing the Photometry with 'missing data' enabled "
124 "and 'upper limit' disabled",
133 "NAN flux encountered when parsing the Photometry with 'missing data' disabled", flux, error);
140 "Zero error encountered when parsing the Photometry with 'missing data' disabled and 'upper limit' enabled", flux,
147 error = flux / n_threshod_iter->second;
151 "Negative or Zero flux encountered when parsing the Photometry in the context of an 'upper limit'", flux, error);
153 error = std::abs(error);
159 "Negative or Zero error encountered when parsing the Photometry with 'missing data' "
160 "and 'upper limit' disabled",
166 photometry_vector.push_back(
FluxErrorPair{flux, error, missing_data, upper_limit});
172 return photometry_ptr;