42 const bool missing_photometry_enabled,
const double missing_photometry_flag,
const bool upper_limit_enabled,
45 : m_missing_photometry_enabled(missing_photometry_enabled)
46 , m_missing_photometry_flag(missing_photometry_flag)
47 , m_upper_limit_enabled(upper_limit_enabled)
49 , m_n_upper_limit_flag(n_upper_limit_flag)
50 , m_convert_from_mag(convert_from_mag) {
55 for (
auto filter_name_pair : filter_name_mapping) {
56 flux_column_index_ptr = column_info_ptr->find(filter_name_pair.second.first);
57 error_column_index_ptr = column_info_ptr->find(filter_name_pair.second.second);
59 if (flux_column_index_ptr ==
nullptr) {
60 throw Elements::Exception() <<
"Column info does not have the flux column " << filter_name_pair.second.first;
62 if (error_column_index_ptr ==
nullptr) {
64 << filter_name_pair.second.second;
71 for (
auto a_filter_name_map : filter_name_mapping) {
77 m_convert_from_mag = std::vector<std::pair<std::string, bool>>();
78 for (auto m_n_pair : m_n_map) {
79 m_convert_from_mag.push_back(std::make_pair(m_n_pair.first, false));
122 auto n_threshod_iter = m_n_map.begin();
123 auto convert_from_mag_iter = m_convert_from_mag.begin();
124 for (
auto& filter_index_pair : m_table_index_vector) {
131 if (convert_from_mag_iter->second) {
132 auto converted = convertFromMag(flux, error);
133 flux = converted.first;
134 error = converted.second;
137 bool upper_limit =
false;
143 if (m_missing_photometry_enabled && missing_data) {
145 }
else if (!m_missing_photometry_enabled && missing_data) {
147 context_desc.c_str(), flux, error);
148 }
else if (m_upper_limit_enabled) {
152 context_desc.c_str(), flux, error);
157 error = flux / n_threshod_iter->second;
162 "Negative or Zero flux encountered when parsing the Photometry ", context_desc.c_str(), flux, error);
165 error = std::abs(error);
171 "Negative or Zero error encountered when parsing the Photometry ", context_desc.c_str(), flux, error);
175 photometry_vector.push_back(
FluxErrorPair{flux, error, missing_data, upper_limit});
177 ++convert_from_mag_iter;
182 return photometry_ptr;
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, const std::vector< std::pair< std::string, bool > > &convert_from_mag={})
Create a PhotometryAttributeFromRow object.
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.