SourceXtractorPlusPlus  0.8
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
28 #include "ModelFitting/utils.h"
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  assert(measurements.size() > 0);
52  size_t nentries = measurements.size();
53  size_t napertures = measurements.front().getFlags().size();
54  std::vector<size_t> shape{nentries, napertures};
55 
56  m_fluxes = make_unique<NdArray<SeFloat>>(shape);
57  m_flux_errors = make_unique<NdArray<SeFloat>>(shape);
58  m_mags = make_unique<NdArray<SeFloat>>(shape);
59  m_mag_errors = make_unique<NdArray<SeFloat>>(shape);
60  m_flags = make_unique<NdArray<int64_t>>(shape);
61 
62  for (size_t entry_idx = 0; entry_idx < nentries; ++entry_idx) {
63  const auto& entry = measurements[entry_idx];
64  for (size_t ap_idx = 0; ap_idx < napertures; ++ap_idx) {
65  m_fluxes->at(entry_idx, ap_idx) = entry.getFluxes()[ap_idx];
66  m_flux_errors->at(entry_idx, ap_idx) = entry.getFluxErrors()[ap_idx];
67  m_mags->at(entry_idx, ap_idx) = entry.getMags()[ap_idx];
68  m_mag_errors->at(entry_idx, ap_idx) = entry.getMagErrors()[ap_idx];
69  m_flags->at(entry_idx, ap_idx) = flags2long(entry.getFlags()[ap_idx]);
70  }
71  }
72  }
73 
74  const NdArray<SeFloat> &getFluxes() const {
75  return *m_fluxes;
76  }
77 
79  return *m_flux_errors;
80  }
81 
82  const NdArray<SeFloat> &getMags() const {
83  return *m_mags;
84  }
85 
86  const NdArray<SeFloat> &getMagErrors() const {
87  return *m_mag_errors;
88  }
89 
90  const NdArray<int64_t> &getFlags() const {
91  return *m_flags;
92  }
93 
94 private:
100 };
101 
102 } /* namespace SourceXtractor */
103 
104 #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)
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
const NdArray< SeFloat > & getFluxErrors() const
AperturePhotometryArray(const std::vector< AperturePhotometry > &measurements)
T size(T...args)
STL class.
STL class.
const NdArray< SeFloat > & getMagErrors() const
const NdArray< SeFloat > & getFluxes() const
Merges all AperturePhotometries into a multidimensional property.
const NdArray< SeFloat > & getMags() const
const NdArray< int64_t > & getFlags() const
std::unique_ptr< NdArray< SeFloat > > m_flux_errors
std::unique_ptr< NdArray< SeFloat > > m_fluxes