本文整理汇总了C++中Noise::pvalue方法的典型用法代码示例。如果您正苦于以下问题:C++ Noise::pvalue方法的具体用法?C++ Noise::pvalue怎么用?C++ Noise::pvalue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Noise
的用法示例。
在下文中一共展示了Noise::pvalue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findPeaks
void PeakFinder_SNR::findPeaks(const OrderedPairContainerRef& pairs,
vector<size_t>& resultIndices) const
{
vector<OrderedPair> preprocessedData;
if (config_.preprocessWithLogarithm)
transform(pairs.begin(), pairs.end(), back_inserter(preprocessedData), ComputeLogarithm());
const OrderedPairContainerRef& data = config_.preprocessWithLogarithm ? preprocessedData : pairs;
Noise noise = noiseCalculator_->calculateNoise(data); // TODO: investigate calculating noise on unprocessed data
vector<double> pvalues;
transform(data.begin(), data.end(), back_inserter(pvalues), CalculatePValue(noise));
vector<double> rollingProducts = calculateRollingProducts(pvalues, config_.windowRadius);
if (rollingProducts.size() != data.size())
throw runtime_error("[PeakFinder_SNR::findPeaks()] This isn't happening");
double thresholdValue = noise.mean + config_.zValueThreshold * noise.standardDeviation;
double thresholdPValue = noise.pvalue(thresholdValue);
double threshold = ((double(*)(double,int))std::pow)(thresholdPValue, 1+2*config_.windowRadius);
// report local minima above the threshold
for (size_t i=0; i<rollingProducts.size(); i++)
{
if ((i==0 || rollingProducts[i]<rollingProducts[i-1]) &&
(i+1==rollingProducts.size() || rollingProducts[i]<rollingProducts[i+1]) &&
rollingProducts[i] < threshold)
{
resultIndices.push_back(i);
}
}
if (config_.log)
{
ostream& log = *config_.log;
log << "[PeakFinder_SNR::findPeaks()]\n";
log << "# noise: " << noise.mean << " " << noise.standardDeviation << endl;
log << "# thresholdValue: " << thresholdValue << endl;
log << "# thresholdPValue: " << thresholdPValue << endl;
log << "# threshold: " << threshold << endl;
log << "#\n";
log << "# found data pvalue rollingProduct\n";
for (size_t i=0; i<data.size(); ++i)
{
bool found = (find(resultIndices.begin(), resultIndices.end(), i) != resultIndices.end());
log << (found?"* ":" ") << fixed << setprecision(6) << data[i] << scientific << setw(15) << pvalues[i] << setw(15) << rollingProducts[i] << endl;
}
log << endl;
log << "[PeakFinder_SNR::findPeaks()] end\n";
}
}