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;
bool m_missing_photometry_enabled
PhotometryAttributeFromRow(std::shared_ptr< Euclid::Table::ColumnInfo > column_info_ptr, const std::vector< std::pair< std::string, std::pair< std::string, std::string >>> &filter_name_mapping, const bool missing_photometry_enabled, const double missing_photometry_flag, const bool upper_limit_enabled, const std::vector< std::pair< std::string, float >> n_map, const double n_upper_limit_flag)
Create a PhotometryAttributeFromRow object.
double m_n_upper_limit_flag
std::vector< std::pair< size_t, size_t > > m_table_index_vector
Represents one row of a Table.
boost::variant< bool, int32_t, int64_t, float, double, std::string, std::vector< bool >, std::vector< int32_t >, std::vector< int64_t >, std::vector< float >, std::vector< double >, NdArray::NdArray< int32_t >, NdArray::NdArray< int64_t >, NdArray::NdArray< float >, NdArray::NdArray< double > > cell_type
The possible cell types.
double m_missing_photometry_flag
std::shared_ptr< std::vector< std::string > > m_filter_name_vector_ptr
virtual ~PhotometryAttributeFromRow()
std::unique_ptr< Attribute > createAttribute(const Euclid::Table::Row &row) override
Create a photometricAttribute from a Table row.
bool isEqual(const RawType &left, const RawType &right)
std::vector< std::pair< std::string, float > > m_n_map
bool m_upper_limit_enabled