17 #include <tspectrum.h>
19 std::vector<std::pair<double, double>> SpectrumUtils::FindPeaks(
const Histogram2D& hist,
21 const std::string& option,
26 tspectrum::Spectrum2D spec;
27 auto peaks = spec.find_peaks(arr, sigma, option, threshold);
30 std::vector<std::pair<double, double>> result;
32 for (
const auto& p : peaks) {
33 double row_value = p.first;
34 double col_value = p.second;
36 size_t xaxis_index =
static_cast<size_t>(col_value);
37 size_t yaxis_index = hist.
getYaxis().
size() - 1 -
static_cast<size_t>(row_value);
42 double dx = col_value -
static_cast<size_t>(col_value);
43 double dy = -1.0 * (row_value -
static_cast<size_t>(row_value));
45 double x = xbin.getMidPoint() + xbin.getBinSize() * dx;
46 double y = ybin.getMidPoint() + ybin.getBinSize() * dy;
48 result.push_back(std::make_pair(x, y));
PyObvject forward declaration.
Two dimensional histogram.
virtual Bin1D getBin(size_t index) const =0
retrieve a 1d bin for the given index
virtual size_t size() const =0
retrieve the number of bins
OutputData< double > * createOutputData(DataType dataType=DataType::INTEGRAL) const
creates new OutputData with histogram's shape and values corresponding to DataType
const IAxis & getYaxis() const
returns y-axis for 2D histograms
const IAxis & getXaxis() const
returns x-axis
decltype(auto) createVector2D(const T &data)
Creates 2D vector from OutputData.