Exemple #1
0
//virtual
bool
datafile::getSpectrum( int /* fcn*/, size_t idx, adcontrols::MassSpectrum& ms, uint32_t /* objid */) const
{
    if ( unsigned( idx ) < spcfile_->number_of_subfiles() ) {

        const galactic::spchdr& hdr = *spcfile_->spchdr();
        const galactic::subhdr& sub = *spcfile_->subhdr( idx );

        std::pair< double, double > range = std::make_pair( hdr.ffirst(), hdr.flast() );
        const size_t npts = hdr.fnpts();
        ms.resize( npts );
        ms.setAcquisitionMassRange( range.first, range.second );
        
        for ( size_t i = 0; i < npts; ++i ) {
            ms.setMass( int(i), i * double(( range.second - range.first )) / ( npts - 1 ) + range.first );
            ms.setIntensity( int(i), sub[i] );
        }
        return true;
    }
	return false;
}