Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Euclid::SourceCatalog::PhotometryAttributeFromRow Class Reference

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>

Inheritance diagram for Euclid::SourceCatalog::PhotometryAttributeFromRow:
Inheritance graph
[legend]
Collaboration diagram for Euclid::SourceCatalog::PhotometryAttributeFromRow:
Collaboration graph
[legend]

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< AttributecreateAttribute (const Euclid::Table::Row &row) override
 Create a photometricAttribute from a Table row.
 
std::pair< double, doubleconvertFromMag (const double mag, const double mag_err) const
 
- Public Member Functions inherited from Euclid::SourceCatalog::AttributeFromRow
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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PhotometryAttributeFromRow()

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.

Parameters
column_info_ptrdescribes the columns of the Table providing in particular the require column names
filter_name_mappingsupplies the mapping between the filter name (std::string) and the Table column names, both for the flux and for the error columns
has_missing_photometryIf true the attribute accept values indicating that the photometry is missing
missing_photometry_flagprovides the value of the flag when no data is available
has_upper_limitif true the attribute accept values indicating that the flux is an upper limit and not an actual value
Exceptions
Anexception 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().

Here is the call graph for this function:

◆ ~PhotometryAttributeFromRow()

Euclid::SourceCatalog::PhotometryAttributeFromRow::~PhotometryAttributeFromRow ( )
virtualdefault

Member Function Documentation

◆ convertFromMag()

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().

Here is the call graph for this function:

◆ createAttribute()

std::unique_ptr< Attribute > Euclid::SourceCatalog::PhotometryAttributeFromRow::createAttribute ( const Euclid::Table::Row row)
overridevirtual

Create a photometricAttribute from a Table row.

Create a photometricAttribute from a Table row using the mapping included in this object

Parameters
rowA Table row
Returns
A unique pointer to a (Photometry) Attribute

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.

Here is the call graph for this function:

Member Data Documentation

◆ m_convert_from_mag

std::vector<std::pair<std::string, bool> > Euclid::SourceCatalog::PhotometryAttributeFromRow::m_convert_from_mag
private

Definition at line 126 of file PhotometryAttributeFromRow.h.

Referenced by createAttribute(), and PhotometryAttributeFromRow().

◆ m_filter_name_vector_ptr

std::shared_ptr<std::vector<std::string> > Euclid::SourceCatalog::PhotometryAttributeFromRow::m_filter_name_vector_ptr
private

Definition at line 111 of file PhotometryAttributeFromRow.h.

Referenced by createAttribute(), and PhotometryAttributeFromRow().

◆ m_missing_photometry_enabled

bool Euclid::SourceCatalog::PhotometryAttributeFromRow::m_missing_photometry_enabled
private

Definition at line 113 of file PhotometryAttributeFromRow.h.

Referenced by createAttribute().

◆ m_missing_photometry_flag

double Euclid::SourceCatalog::PhotometryAttributeFromRow::m_missing_photometry_flag
private

Definition at line 118 of file PhotometryAttributeFromRow.h.

Referenced by convertFromMag(), and createAttribute().

◆ m_n_map

std::vector<std::pair<std::string, float> > Euclid::SourceCatalog::PhotometryAttributeFromRow::m_n_map
private

Definition at line 122 of file PhotometryAttributeFromRow.h.

Referenced by createAttribute(), and PhotometryAttributeFromRow().

◆ m_n_upper_limit_flag

double Euclid::SourceCatalog::PhotometryAttributeFromRow::m_n_upper_limit_flag
private

Definition at line 124 of file PhotometryAttributeFromRow.h.

Referenced by convertFromMag(), and createAttribute().

◆ m_table_index_vector

std::vector<std::pair<size_t, size_t> > Euclid::SourceCatalog::PhotometryAttributeFromRow::m_table_index_vector
private

Definition at line 106 of file PhotometryAttributeFromRow.h.

Referenced by createAttribute(), and PhotometryAttributeFromRow().

◆ m_upper_limit_enabled

bool Euclid::SourceCatalog::PhotometryAttributeFromRow::m_upper_limit_enabled
private

Definition at line 120 of file PhotometryAttributeFromRow.h.

Referenced by createAttribute().


The documentation for this class was generated from the following files: