void SeriesData::setData( const adcontrols::Chromatogram& c ) { values_.resize( c.size() ); range_x_ = adcontrols::Chromatogram::toMinutes( c.timeRange() ); range_y_ = std::pair<double, double>( c.getMinIntensity(), c.getMaxIntensity() ); const double *x = c.getTimeArray(); const double *y = c.getIntensityArray(); const size_t size = c.size(); if ( x ) { for ( size_t i = 0; i < size; ++i ) values_[i] = QPointF( adcontrols::Chromatogram::toMinutes( x[i] ), y[i] ); } else { for ( size_t i = 0; i < size; ++i ) values_[i] = QPointF( adcontrols::Chromatogram::toMinutes( c.timeFromDataIndex( i ) ), y[i] ); } }
bool ChromatographyImpl::findPeaks( const adcontrols::Chromatogram& c ) { using adcontrols::Peaks; using adcontrols::Baselines; Integrator integrator; integrator.minimum_width( method_.minimumWidth() * 60.0 ); // min -> sec integrator.slope_sensitivity( method_.slope() ); // uV/sec -> uV/sec integrator.drift( method_.drift() / 60.0 ); // uV/min -> uV/sec integrator.timeOffset( c.minimumTime() ); integrator.samping_interval( c.sampInterval() ); // sec const size_t nSize = c.size(); const double * y = c.getIntensityArray(); for ( size_t i = 0; i < nSize; ++i ) integrator << *y++; integrator.close( method_, peaks_, baselines_ ); //size_t N = 0; //double sd = 0; double heightTotal = 0; double areaTotal = 0; for ( Peaks::vector_type::const_iterator it = peaks_.begin(); it != peaks_.end(); ++it ) { heightTotal += it->peakHeight(); areaTotal += it->peakArea(); } peaks_.heightTotal( heightTotal ); peaks_.areaTotal( areaTotal ); for ( Peaks::vector_type::iterator it = peaks_.begin(); it != peaks_.end(); ++it ) { it->percentArea( ( it->peakArea() / areaTotal ) * 100 ); it->percentHeight( ( it->peakHeight() / heightTotal ) * 100 ); } return true; }