SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
SEImplementation
Plugin
AperturePhotometry
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
27
#include "AlexandriaKernel/memory_tools.h"
28
#include "
SEImplementation/Plugin/AperturePhotometry/AperturePhotometry.h
"
29
#include "NdArray/NdArray.h"
30
#include <memory>
31
#include <cassert>
32
33
34
namespace
SourceXtractor
{
35
40
class
AperturePhotometryArray
:
public
Property
{
41
public
:
42
template
<
typename
T>
43
using
NdArray
=
Euclid::NdArray::NdArray<T>
;
44
48
virtual
~AperturePhotometryArray
() =
default
;
49
50
explicit
AperturePhotometryArray
(
const
std::vector<AperturePhotometry>
&
measurements
) {
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
80
const
NdArray<SeFloat>
&
getFluxErrors
()
const
{
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
:
97
std::unique_ptr<NdArray<SeFloat>
>
m_fluxes
;
98
std::unique_ptr<NdArray<SeFloat>
>
m_flux_errors
;
99
std::unique_ptr<NdArray<SeFloat>
>
m_mags
;
100
std::unique_ptr<NdArray<SeFloat>
>
m_mag_errors
;
101
std::unique_ptr<NdArray<int64_t>
>
m_flags
;
102
};
103
104
}
/* namespace SourceXtractor */
105
106
#endif
/* _SEIMPLEMENTATION_PLUGIN_APERTUREPHOTOMETRY_APERTUREPHOTOMETRY_H_ */
AperturePhotometry.h
Euclid::NdArray::NdArray
Euclid::NdArray::NdArray::at
T & at(const std::vector< size_t > &coords)
SourceXtractor::AperturePhotometryArray
Merges all AperturePhotometries into a multidimensional property.
Definition
AperturePhotometryArray.h:40
SourceXtractor::AperturePhotometryArray::getFluxErrors
const NdArray< SeFloat > & getFluxErrors() const
Definition
AperturePhotometryArray.h:80
SourceXtractor::AperturePhotometryArray::~AperturePhotometryArray
virtual ~AperturePhotometryArray()=default
Destructor.
SourceXtractor::AperturePhotometryArray::m_flux_errors
std::unique_ptr< NdArray< SeFloat > > m_flux_errors
Definition
AperturePhotometryArray.h:98
SourceXtractor::AperturePhotometryArray::m_mags
std::unique_ptr< NdArray< SeFloat > > m_mags
Definition
AperturePhotometryArray.h:99
SourceXtractor::AperturePhotometryArray::getMags
const NdArray< SeFloat > & getMags() const
Definition
AperturePhotometryArray.h:84
SourceXtractor::AperturePhotometryArray::AperturePhotometryArray
AperturePhotometryArray(const std::vector< AperturePhotometry > &measurements)
Definition
AperturePhotometryArray.h:50
SourceXtractor::AperturePhotometryArray::m_fluxes
std::unique_ptr< NdArray< SeFloat > > m_fluxes
Definition
AperturePhotometryArray.h:97
SourceXtractor::AperturePhotometryArray::getMagErrors
const NdArray< SeFloat > & getMagErrors() const
Definition
AperturePhotometryArray.h:88
SourceXtractor::AperturePhotometryArray::getFlags
const NdArray< int64_t > & getFlags() const
Definition
AperturePhotometryArray.h:92
SourceXtractor::AperturePhotometryArray::m_mag_errors
std::unique_ptr< NdArray< SeFloat > > m_mag_errors
Definition
AperturePhotometryArray.h:100
SourceXtractor::AperturePhotometryArray::m_flags
std::unique_ptr< NdArray< int64_t > > m_flags
Definition
AperturePhotometryArray.h:101
SourceXtractor::AperturePhotometryArray::getFluxes
const NdArray< SeFloat > & getFluxes() const
Definition
AperturePhotometryArray.h:76
SourceXtractor::Property
Base class for all Properties. (has no actual content)
Definition
Property.h:33
std::function
Euclid::NdArray
Euclid::make_unique
std::unique_ptr< T > make_unique(Args &&... args)
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::flags2long
constexpr int64_t flags2long(const Flags &a)
Definition
SourceFlags.h:90
Generated by
1.10.0