SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
FluxRadiusTask.cpp
Go to the documentation of this file.
1
18#include <algorithm>
19#include <functional>
20
21#include <NdArray/NdArray.h>
26
27using namespace Euclid::NdArray;
28
29namespace SourceXtractor {
30
34
37
38 for (size_t i = 0; i < m_instances.size(); ++i) {
39 auto& growth_curve_prop = source.getProperty<GrowthCurve>(m_instances[i]);
40 auto& growth_curve = growth_curve_prop.getCurve();
41 auto step_size = growth_curve_prop.getStepSize();
42
44 for (size_t s = 0; s < steps.size(); ++s) {
45 steps[s] = (s + 1) * step_size;
46 }
47
48 for (size_t j = 0; j < m_flux_fraction.size(); ++j) {
50
51 // We can not use Alexandria's interpolation because the accumulated flux is not
52 // strictly increasing, so we search for the first bin where the accumulated flux is
53 // >= the target flux, and interpolate with the previous one
55 std::bind(std::greater_equal<double>(), std::placeholders::_1, target_flux));
56 if (next == std::end(growth_curve)) {
57 --next;
58 }
60
61 SeFloat y0, y1;
63
64 x1 = *next;
65 y1 = steps[next_i];
66 if (next_i > 0) {
67 x0 = *(next - 1);
68 y0 = steps[next_i - 1];
69 }
70 else {
71 x0 = 0;
72 y0 = 0;
73 }
74
75 SeFloat slope = (y1 - y0) / (x1 - x0);
77 radii.at(i, j) = std::min(target_radius, static_cast<SeFloat>(steps.back()));
78 }
79 }
80 source.setProperty<FluxRadius>(std::move(radii));
81}
82
83} // end of namespace SourceXtractor
T begin(T... args)
T bind(T... args)
std::vector< SeFloat > m_flux_fraction
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
FluxRadiusTask(const std::vector< unsigned > &instances, const std::vector< SeFloat > &flux_frac)
std::vector< unsigned > m_instances
The SourceInterface is an abstract "source" that has properties attached to it.
T distance(T... args)
T end(T... args)
T find_if(T... args)
T max(T... args)
T min(T... args)
T move(T... args)
SeFloat32 SeFloat
Definition Types.h:32
T next(T... args)
T size(T... args)