35 #ifndef OPENMS_FORMAT_PEAKTYPEESTIMATOR_H 
   36 #define OPENMS_FORMAT_PEAKTYPEESTIMATOR_H 
   58     template <
typename PeakConstIterator>
 
   61       const Size MAX_SAMPLED_DISTANCES = 1000;
 
   62       const DoubleReal DISTANCE_VARIANCE_THRESHOLD = 0.5;
 
   72       std::vector<DoubleReal> distances;
 
   74       PeakConstIterator peak(begin);
 
   76       for (; peak->getIntensity() <= 0 && peak != end - 2; ++peak)  
 
   82       for (++peak; peak->getIntensity() <= 0 && peak != end - 1; ++peak) 
 
   90       for (++peak; peak != end && count < MAX_SAMPLED_DISTANCES; ++peak) 
 
   92         if (peak->getIntensity() > 0)
 
   96           distances.push_back(std::min(last_dist, dist)); 
 
   98           scnd_last_mz = last_mz;
 
  109       DoubleReal mean(std::accumulate(distances.begin(), distances.end(), 0) / count); 
 
  113       for (std::vector<DoubleReal>::iterator value = distances.begin(); value != distances.end(); ++value)
 
  116         variance += delta * delta;
 
  118       variance /= count - 1;
 
  121       DoubleReal standard_deviation(std::sqrt(variance));
 
  123       if (standard_deviation < DISTANCE_VARIANCE_THRESHOLD)
 
  137 #endif // OPENMS_FORMAT_PEAKTYPEESTIMATOR_H 
Peak data (also called centroided data or stick data) 
Definition: SpectrumSettings.h:74
SpectrumType
Spectrum peak type. 
Definition: SpectrumSettings.h:71
SpectrumSettings::SpectrumType estimateType(const PeakConstIterator &begin, const PeakConstIterator &end) const 
Estimates the peak type of the peaks in the iterator range based on the variance of inter-peak distan...
Definition: PeakTypeEstimator.h:59
Raw data (also called profile data) 
Definition: SpectrumSettings.h:75
Unknown spectrum type. 
Definition: SpectrumSettings.h:73
static DoubleReal mean(IteratorType begin, IteratorType end)
Calculates the mean of a range of values. 
Definition: StatisticFunctions.h:69
Estimates if the data of a spectrum is raw data or peak data. 
Definition: PeakTypeEstimator.h:50
size_t Size
Size type e.g. used as variable which can hold result of size() 
Definition: Types.h:144