本文整理汇总了C++中Peak::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ Peak::Set方法的具体用法?C++ Peak::Set怎么用?C++ Peak::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Peak
的用法示例。
在下文中一共展示了Peak::Set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiscoverPeaks
int PeakProcessor::DiscoverPeaks (std::vector<double> *vect_mz, std::vector<double> *vect_intensity, double start_mz, double stop_mz)
{
if(vect_intensity->size() < 1)
return 0 ;
mobj_peak_data->Clear() ;
int num_data_pts = (int) (*vect_intensity).size() ;
int ilow ;
int ihigh ;
Peak peak ;
int start_index = mobj_pk_index.GetNearestBinary(*vect_mz, start_mz, 0, num_data_pts-1) ;
int stop_index = mobj_pk_index.GetNearestBinary(*vect_mz, stop_mz, start_index, num_data_pts-1) ;
if (start_index <= 0)
start_index = 1 ;
if (stop_index >= (int)vect_mz->size() -2)
stop_index = (int)vect_mz->size() - 2 ;
for (int index = start_index ; index <= stop_index ; index++)
{
double FWHM = -1 ;
double current_intensity = (*vect_intensity)[index] ;
double last_intensity = (*vect_intensity)[index-1] ;
double next_intensity = (*vect_intensity)[index+1] ;
double current_mz = (*vect_mz)[index] ;
if (menm_profile_type == CENTROIDED)
{
if (current_intensity >= mdbl_peak_intensity_threshold)
{
double mass_ = (*vect_mz)[index] ;
double SN = current_intensity / mdbl_peak_intensity_threshold ;
double FWHM = 0.6 ;
peak.Set(mass_, current_intensity, SN, mobj_peak_data->GetNumPeaks(), index, FWHM) ;
mobj_peak_data->AddPeak(peak) ;
}
}
else if (menm_profile_type == PROFILE)
{
if(current_intensity >= last_intensity && current_intensity >= next_intensity
&& current_intensity >= this->mdbl_peak_intensity_threshold)
{
//See if the peak meets the conditions.
//The peak data will be found at _transformData->begin()+i+1.
double SN = 0 ;
if (!mbln_thresholded_data)
SN = this->mobj_peak_statistician.FindSignalToNoise(current_intensity, (*vect_intensity), index);
else
SN = current_intensity / mdbl_background_intensity ;
// Run Full-Width Half-Max algorithm to try and squeak out a higher SN
if(SN < this->mdbl_signal_2_noise_threshold)
{
double mass_ = (*vect_mz)[index] ;
FWHM = this->mobj_peak_statistician.FindFWHM((*vect_mz), (*vect_intensity), index, SN);
if(FWHM > 0 && FWHM < 0.5)
{
ilow = mobj_pk_index.GetNearestBinary((*vect_mz), current_mz - FWHM, 0, index);
ihigh = mobj_pk_index.GetNearestBinary((*vect_mz), current_mz + FWHM, index, stop_index);
double low_intensity = (*vect_intensity)[ilow] ;
double high_intensity = (*vect_intensity)[ihigh] ;
double sum_intensity = low_intensity + high_intensity ;
if(sum_intensity)
SN = (2.0 * current_intensity) / sum_intensity ;
else
SN = 10;
}
}
// Found a peak, make sure it is in the attention list, if there is one.
if(SN >= this->mdbl_signal_2_noise_threshold && ( !this->mbln_chk_attention_list || this->IsInAttentionList(current_mz)))
{
// Find a more accurate m/z location of the peak.
double fittedPeak = mobj_peak_fit.Fit(index, (*vect_mz), (*vect_intensity));
if (FWHM == -1)
{
FWHM = this->mobj_peak_statistician.FindFWHM((*vect_mz), (*vect_intensity), index, SN);
}
if (FWHM > 0)
{
peak.Set(fittedPeak, current_intensity, SN, mobj_peak_data->GetNumPeaks(), index, FWHM) ;
mobj_peak_data->AddPeak(peak) ;
}
// move beyond peaks have the same intensity.
bool incremented = false ;
while( index < num_data_pts && (*vect_intensity)[index] == current_intensity)
{
incremented = true ;
index++ ;
}
if(index > 0 && index < num_data_pts
&& incremented)
index-- ;
}
}
//.........这里部分代码省略.........