Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
Implementation of the AttributeFromRow for a photometry attribute. This class implements the createAttribute method that must be used to create Photometry objects. More...
#include <PhotometryAttributeFromRow.h>
Public Member Functions | |
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. | |
virtual | ~PhotometryAttributeFromRow () |
std::unique_ptr< Attribute > | createAttribute (const Euclid::Table::Row &row) override |
Create a photometricAttribute from a Table row. | |
std::pair< double, double > | convertFromMag (const double mag, const double mag_err) const |
![]() | |
virtual | ~AttributeFromRow ()=default |
Private Attributes | |
std::vector< std::pair< size_t, size_t > > | m_table_index_vector |
std::shared_ptr< std::vector< std::string > > | m_filter_name_vector_ptr |
bool | m_missing_photometry_enabled |
double | m_missing_photometry_flag |
bool | m_upper_limit_enabled |
std::vector< std::pair< std::string, float > > | m_n_map |
double | m_n_upper_limit_flag |
std::vector< std::pair< std::string, bool > > | m_convert_from_mag |
Implementation of the AttributeFromRow for a photometry attribute. This class implements the createAttribute method that must be used to create Photometry objects.
Definition at line 50 of file PhotometryAttributeFromRow.h.
Euclid::SourceCatalog::PhotometryAttributeFromRow::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.
Create a PhotometryAttributeFromRow object, setting up the rule for building PhotometryAttribute from table rows. The filter_name_mapping provides the correspondence between the filterName (string) and the names used for the Table columns. These names (of the flux and the error columns) are searched in the columnInfo of the Table and a new mapping between the filterName and the indices of the flux and of the error columns is built. The user must provide this mapping between the filterName (which are then used throughout the processing) and the column names which comes from the input photometric (ASCII or FITS) catalog.
column_info_ptr | describes the columns of the Table providing in particular the require column names |
filter_name_mapping | supplies the mapping between the filter name (std::string) and the Table column names, both for the flux and for the error columns |
has_missing_photometry | If true the attribute accept values indicating that the photometry is missing |
missing_photometry_flag | provides the value of the flag when no data is available |
has_upper_limit | if true the attribute accept values indicating that the flux is an upper limit and not an actual value |
An | exception is thrown if the names provided in the mapping are not present in the columnInfo. |
Definition at line 39 of file PhotometryAttributeFromRow.cpp.
References m_convert_from_mag, m_filter_name_vector_ptr, m_n_map, m_table_index_vector, std::make_pair(), std::vector< T >::push_back(), and std::vector< T >::size().
|
virtualdefault |
std::pair< double, double > Euclid::SourceCatalog::PhotometryAttributeFromRow::convertFromMag | ( | const double | mag, |
const double | mag_err | ||
) | const |
Definition at line 86 of file PhotometryAttributeFromRow.cpp.
References Elements::almostEqual2sComplement(), std::isnan(), std::log(), m_missing_photometry_flag, m_n_upper_limit_flag, std::make_pair(), and std::pow().
Referenced by createAttribute().
|
overridevirtual |
Create a photometricAttribute from a Table row.
Create a photometricAttribute from a Table row using the mapping included in this object
row | A Table row |
Upper limit enabled
Actual upper limit
Upper limit disabled
Implements Euclid::SourceCatalog::AttributeFromRow.
Definition at line 117 of file PhotometryAttributeFromRow.cpp.
References Elements::almostEqual2sComplement(), std::vector< T >::begin(), convertFromMag(), Euclid::SourceCatalog::getContextDescription(), std::isfinite(), m_convert_from_mag, m_filter_name_vector_ptr, m_missing_photometry_enabled, m_missing_photometry_flag, m_n_map, m_n_upper_limit_flag, m_table_index_vector, and m_upper_limit_enabled.
|
private |
Definition at line 126 of file PhotometryAttributeFromRow.h.
Referenced by createAttribute(), and PhotometryAttributeFromRow().
|
private |
Definition at line 111 of file PhotometryAttributeFromRow.h.
Referenced by createAttribute(), and PhotometryAttributeFromRow().
|
private |
Definition at line 113 of file PhotometryAttributeFromRow.h.
Referenced by createAttribute().
|
private |
Definition at line 118 of file PhotometryAttributeFromRow.h.
Referenced by convertFromMag(), and createAttribute().
|
private |
Definition at line 122 of file PhotometryAttributeFromRow.h.
Referenced by createAttribute(), and PhotometryAttributeFromRow().
|
private |
Definition at line 124 of file PhotometryAttributeFromRow.h.
Referenced by convertFromMag(), and createAttribute().
|
private |
Definition at line 106 of file PhotometryAttributeFromRow.h.
Referenced by createAttribute(), and PhotometryAttributeFromRow().
|
private |
Definition at line 120 of file PhotometryAttributeFromRow.h.
Referenced by createAttribute().