Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
SpectroscopicRedshiftAttributeFromRow.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012-2022 Euclid Science Ground Segment
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 3.0 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
26#ifndef SPECTROSCOPICATTRIBUTEFROMROW_H_
27#define SPECTROSCOPICATTRIBUTEFROMROW_H_
28#include <map>
29#include <memory>
30#include <string>
31#include <utility>
32
36#include "Table/CastVisitor.h"
37#include "Table/Table.h"
38
39namespace Euclid {
40namespace SourceCatalog {
41
42static Elements::Logging logger = Elements::Logging::getLogger("SpectroscopicRedshiftAttributeFromRow");
43
53public:
92
112
114 if (specz_value_column_index_ptr == nullptr) {
115 throw Elements::Exception() << "Column info does not have the spectroscopic redshift value column!";
116 }
117
118 m_has_error_column = false;
121
122 // Log a warning as row is set to zero
123 logger.warn() << "specz error values are set to zero by default! ";
124 }
125
127
135 double z = boost::apply_visitor(Table::CastVisitor<double>{}, row[m_value_column_index]);
136 double e = 0.;
137 if (m_has_error_column) {
138 e = boost::apply_visitor(Table::CastVisitor<double>{}, row[m_error_column_index]);
139 }
141 }
142
143private:
150};
151
152} // namespace SourceCatalog
153} // end of namespace Euclid
154
155#endif // SPECTROSCOPICATTRIBUTEFROMROW_H_
static Logging getLogger(const std::string &name="")
Interface for building a source Attribute from a table Row.
Store the Right Ascension (Ra) and Delination (Dec) of a source in decimal degrees,...
Definition Coordinates.h:41
Implementation of the AttributeFromRow for a SpectroscopicRedshift attribute. This class implements t...
std::unique_ptr< Attribute > createAttribute(const Euclid::Table::Row &row) override
Create a photometricAttribute from a Table row.
SpectroscopicRedshiftAttributeFromRow(std::shared_ptr< Euclid::Table::ColumnInfo > column_info_ptr, const std::string &specz_value_column_name)
Create a SpectroscopicRedshiftAttributeFromRow object.
SpectroscopicRedshiftAttributeFromRow(std::shared_ptr< Euclid::Table::ColumnInfo > column_info_ptr, const std::string &specz_value_column_name, const std::string &specz_error_column_name)
Create a SpectroscopicRedshiftAttributeFromRow object.
Store the spectroscopic redshift of a source.
Represents one row of a Table.
Definition Row.h:57