Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Photometry.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 PHOTOMETRY_H_
27#define PHOTOMETRY_H_
28
29#include <iterator>
30#include <memory>
31#include <vector>
32
35
37
38namespace Euclid {
39namespace SourceCatalog {
40
42 double flux;
43 double error;
46 FluxErrorPair(double flux, double error, bool missing_photometry_flag = false, bool upper_limit_flag = false);
47 FluxErrorPair(const FluxErrorPair&) = default;
48 bool operator==(const FluxErrorPair& other) const;
49 bool operator!=(const FluxErrorPair& other) const;
50
51 double getFlux() const {
52 return flux;
53 }
54
55 double getError() const {
56 return error;
57 }
58};
59
75
76public:
82 template <bool Const>
151
154
166 : m_filter_name_vector_ptr(filter_name_vector_ptr), m_value_vector(std::move(value_vector)) {
167 if (m_filter_name_vector_ptr == nullptr) {
168 throw Elements::Exception() << "Photometry filter names vector pointer is null";
169 }
170 // Only check the size, but not the consistency
171 if (m_filter_name_vector_ptr->size() != m_value_vector.size()) {
172 throw Elements::Exception() << "Photometry filter names vector has different size than the values vector";
173 }
174 }
175
177 virtual ~Photometry() = default;
178
180 return const_iterator{m_filter_name_vector_ptr->cbegin(), m_value_vector.cbegin()};
181 }
182
184 return const_iterator{m_filter_name_vector_ptr->cend(), m_value_vector.cend()};
185 }
186
188 return const_iterator{m_filter_name_vector_ptr->cbegin(), m_value_vector.cbegin()};
189 }
190
192 return const_iterator{m_filter_name_vector_ptr->cend(), m_value_vector.cend()};
193 }
194
196 return iterator{m_filter_name_vector_ptr->begin(), m_value_vector.begin()};
197 }
198
200 return iterator{m_filter_name_vector_ptr->end(), m_value_vector.end()};
201 }
202
208 return m_filter_name_vector_ptr->size();
209 }
210
221
222 const std::shared_ptr<std::vector<std::string>>& getFilterNames() const;
223
224private:
227
230};
231// Eof class Photometry
232
233#define PHOTOMETRY_IMPL
235#undef PHOTOMETRY_IMPL
236
237} /* namespace SourceCatalog */
238} // end of namespace Euclid
239
240#endif /* PHOTOMETRY_H_ */
Attribute interface extended by all source attributes.
Definition Attribute.h:41
Store the Right Ascension (Ra) and Delination (Dec) of a source in decimal degrees,...
Definition Coordinates.h:41
typename std::conditional< Const, std::vector< FluxErrorPair >::const_iterator, std::vector< FluxErrorPair >::iterator >::type values_iter_t
Definition Photometry.h:93
PhotometryIterator(const filters_iter_t &filters_iter, const values_iter_t &values_iter)
bool operator==(const PhotometryIterator &other) const
PhotometryIterator(const PhotometryIterator< false > &other)
ssize_t operator-(const PhotometryIterator &other) const
typename std::conditional< Const, const FluxErrorPair, FluxErrorPair >::type value_t
Definition Photometry.h:87
typename std::vector< std::string >::const_iterator filters_iter_t
Definition Photometry.h:91
bool operator!=(const PhotometryIterator &other) const
const_iterator cend() const
Definition Photometry.h:183
const_iterator cbegin() const
Definition Photometry.h:179
std::shared_ptr< std::vector< std::string > > m_filter_name_vector_ptr
Shared pointer to the common list of filter names.
Definition Photometry.h:226
PhotometryIterator< false > iterator
Definition Photometry.h:153
std::vector< FluxErrorPair > m_value_vector
The photometry map.
Definition Photometry.h:229
const_iterator end() const
Definition Photometry.h:191
PhotometryIterator< true > const_iterator
Definition Photometry.h:152
Photometry(std::shared_ptr< std::vector< std::string > > filter_name_vector_ptr, std::vector< FluxErrorPair > value_vector)
Constructor which should never be called directly. Use the PhotometryAttributeHandler to build Photom...
Definition Photometry.h:165
std::size_t size() const
Return the size of the photometry map.
Definition Photometry.h:207
virtual ~Photometry()=default
default destructor
const_iterator begin() const
Definition Photometry.h:187
#define ELEMENTS_API
STL namespace.
bool operator==(const FluxErrorPair &other) const
bool operator!=(const FluxErrorPair &other) const
FluxErrorPair(const FluxErrorPair &)=default