コード例 #1
0
//static
bool
DataprocHandler::apply_calibration( adcontrols::MassSpectrum& ms, const adcontrols::MSCalibration& calib )
{
    adcontrols::segment_wrapper<> segments( ms );
    
    if ( calib.algorithm() == adcontrols::MSCalibration::MULTITURN_NORMALIZED ) {
        for ( auto& fms: segments ) {

            const adcontrols::MSProperty& prop = fms.getMSProperty();
            auto sp = adcontrols::MassSpectrometer::create( prop.dataInterpreterClsid() );
            sp->setAcceleratorVoltage( prop.acceleratorVoltage(), prop.tDelay() );

            if ( auto scanLaw = sp->scanLaw() ) {
            
                adcontrols::ComputeMass< adcontrols::ScanLaw > mass_calculator( *scanLaw, calib );
                for ( size_t i = 0; i < fms.size(); ++i ) {
                    double mass = mass_calculator( fms.getTime( i ), prop.mode() );
                    fms.setMass( i, mass );
                }
                fms.setCalibration( calib );
            }
        }
		return true;
    } else {
		for ( auto& fms: segments )
			fms.setCalibration( calib, true );
    }
	return false;
}
コード例 #2
0
ファイル: dataprochandler.cpp プロジェクト: hermixy/qtplatz
//static
bool
DataprocHandler::apply_calibration( adcontrols::MassSpectrum& ms, const adcontrols::MSCalibration& calib )
{
    adcontrols::segment_wrapper<> segments( ms );
    
    if ( calib.algorithm() == adcontrols::MSCalibration::MULTITURN_NORMALIZED ) {
        for ( auto& fms: segments ) {
            const adcontrols::MSProperty& prop = fms.getMSProperty();
            adcontrols::ComputeMass< adcontrols::ScanLaw > mass_calculator( *fms.scanLaw(), calib );
            for ( size_t i = 0; i < fms.size(); ++i ) {
                double mass = mass_calculator( fms.getTime( i ), prop.mode() );
                fms.setMass( i, mass );
            }
			fms.setCalibration( calib );
        }
		return true;
    } else {
		for ( auto& fms: segments )
			fms.setCalibration( calib, true );
    }
	return false;
}