SourceXtractorPlusPlus  0.12
Please provide a description of the project.
AperturePhotometryArray.h
Go to the documentation of this file.
1 
17 /*
18  * AperturePhotometryArray.h
19  *
20  * Created on: Nov 23, 2018
21  * Author: Alejandro Alvarez Ayllon
22  */
23 
24 #ifndef _SEIMPLEMENTATION_PLUGIN_APERTUREPHOTOMETRY_APERTUREPHOTOMETRYARRAY_H_
25 #define _SEIMPLEMENTATION_PLUGIN_APERTUREPHOTOMETRY_APERTUREPHOTOMETRYARRAY_H_
26 
29 #include "NdArray/NdArray.h"
30 #include <memory>
31 #include <cassert>
32 
33 
34 namespace SourceXtractor {
35 
41 public:
42  template<typename T>
44 
48  virtual ~AperturePhotometryArray() = default;
49 
51  using Euclid::make_unique;
52 
53  assert(measurements.size() > 0);
54  size_t nentries = measurements.size();
55  size_t napertures = measurements.front().getFlags().size();
56  std::vector<size_t> shape{nentries, napertures};
57 
58  m_fluxes = Euclid::make_unique<NdArray<SeFloat>>(shape);
59  m_flux_errors = Euclid::make_unique<NdArray<SeFloat>>(shape);
60  m_mags = Euclid::make_unique<NdArray<SeFloat>>(shape);
61  m_mag_errors = Euclid::make_unique<NdArray<SeFloat>>(shape);
62  m_flags = Euclid::make_unique<NdArray<int64_t>>(shape);
63 
64  for (size_t entry_idx = 0; entry_idx < nentries; ++entry_idx) {
65  const auto& entry = measurements[entry_idx];
66  for (size_t ap_idx = 0; ap_idx < napertures; ++ap_idx) {
67  m_fluxes->at(entry_idx, ap_idx) = entry.getFluxes()[ap_idx];
68  m_flux_errors->at(entry_idx, ap_idx) = entry.getFluxErrors()[ap_idx];
69  m_mags->at(entry_idx, ap_idx) = entry.getMags()[ap_idx];
70  m_mag_errors->at(entry_idx, ap_idx) = entry.getMagErrors()[ap_idx];
71  m_flags->at(entry_idx, ap_idx) = flags2long(entry.getFlags()[ap_idx]);
72  }
73  }
74  }
75 
76  const NdArray<SeFloat> &getFluxes() const {
77  return *m_fluxes;
78  }
79 
81  return *m_flux_errors;
82  }
83 
84  const NdArray<SeFloat> &getMags() const {
85  return *m_mags;
86  }
87 
88  const NdArray<SeFloat> &getMagErrors() const {
89  return *m_mag_errors;
90  }
91 
92  const NdArray<int64_t> &getFlags() const {
93  return *m_flags;
94  }
95 
96 private:
102 };
103 
104 } /* namespace SourceXtractor */
105 
106 #endif /* _SEIMPLEMENTATION_PLUGIN_APERTUREPHOTOMETRY_APERTUREPHOTOMETRY_H_ */
constexpr int64_t flags2long(const Flags &a)
Definition: SourceFlags.h:67
virtual ~AperturePhotometryArray()=default
Destructor.
T front(T... args)
const NdArray< SeFloat > & getMagErrors() const
const NdArray< SeFloat > & getFluxErrors() const
T & at(const std::vector< size_t > &coords)
Base class for all Properties. (has no actual content)
Definition: Property.h:33
std::unique_ptr< NdArray< SeFloat > > m_mags
std::unique_ptr< NdArray< int64_t > > m_flags
std::unique_ptr< NdArray< SeFloat > > m_mag_errors
AperturePhotometryArray(const std::vector< AperturePhotometry > &measurements)
T size(T... args)
STL class.
STL class.
const NdArray< SeFloat > & getMags() const
const NdArray< int64_t > & getFlags() const
Merges all AperturePhotometries into a multidimensional property.
std::unique_ptr< NdArray< SeFloat > > m_flux_errors
std::unique_ptr< NdArray< SeFloat > > m_fluxes
const NdArray< SeFloat > & getFluxes() const
std::unique_ptr< T > make_unique(Args &&... args)