68 template <
typename PeakConstIterator>
71 typedef typename PeakConstIterator::value_type PeakT;
78 const int max_peaks = 5;
79 int profile_evidence = 0;
80 int centroid_evidence = 0;
83 std::vector<PeakT> data(begin, end);
85 double total_int = std::accumulate(begin, end, 0.0, [](
double int_,
const PeakT& p) {
return int_ + p.getIntensity(); } );
86 double explained_int = 0;
88 for (
int i = 0; i < max_peaks; ++i)
92 if (explained_int > 0.5 * total_int)
break;
95 Size idx = std::numeric_limits<Size>::max();
97 for (
Size i = 0; i < data.size(); ++i)
99 if (data[i].getIntensity() > int_max)
101 int_max = data[i].getIntensity();
106 if (idx == std::numeric_limits<Size>::max())
break;
109 typedef typename std::vector<PeakT>::iterator
PeakIterator;
112 double int_last = int_max;
113 while (it != data.begin()
114 && it->getIntensity() <= int_last
115 && it->getIntensity() > 0
116 && (it->getIntensity() / int_last) > 0.1
117 && it->getMZ() + 1 > it_max->getMZ())
119 int_last = it->getIntensity();
120 explained_int += int_last;
127 if (it->getIntensity() > int_last) (it+1)->setIntensity(int_last);
130 bool break_left =
false;
131 if (it_max - it < 2+1)
137 it_max->setIntensity(int_max);
138 explained_int -= int_max;
141 while (it != data.end()
142 && it->getIntensity() <= int_last
143 && it->getIntensity() > 0
144 && (it->getIntensity() / int_last) > 0.1
145 && it->getMZ() - 1 < it_max->getMZ())
147 int_last = it->getIntensity();
148 explained_int += int_last;
156 if (it != data.end() && it->getIntensity() > int_last) (it-1)->setIntensity(int_last);
158 if (break_left || it - it_max < 2+1)
170 float evidence_ratio = profile_evidence / float(profile_evidence + centroid_evidence);
173 if (evidence_ratio > 0.75)
Estimates if the data of a spectrum is raw data or peak data.
Definition: PeakTypeEstimator.h:50
static SpectrumSettings::SpectrumType estimateType(const PeakConstIterator &begin, const PeakConstIterator &end)
Estimates the peak type of the peaks in the iterator range based on intensity characteristics of up t...
Definition: PeakTypeEstimator.h:69
SpectrumType
Spectrum peak type.
Definition: SpectrumSettings.h:71
@ UNKNOWN
Unknown spectrum type.
Definition: SpectrumSettings.h:72
@ PROFILE
profile data
Definition: SpectrumSettings.h:74
@ CENTROID
centroid data or stick data
Definition: SpectrumSettings.h:73
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
RawDataVector::iterator PeakIterator
Profile data iterator type.
Definition: OptimizePick.h:58
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47