本文整理汇总了C++中adcontrols::MassSpectrum::setIntensityArray方法的典型用法代码示例。如果您正苦于以下问题:C++ MassSpectrum::setIntensityArray方法的具体用法?C++ MassSpectrum::setIntensityArray怎么用?C++ MassSpectrum::setIntensityArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adcontrols::MassSpectrum
的用法示例。
在下文中一共展示了MassSpectrum::setIntensityArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//virtual
bool
datafile::getSpectrum( int fcn, size_t pos, adcontrols::MassSpectrum& ms, uint32_t objId ) const
{
(void)fcn;
try {
EDAL::IMSSpectrumCollectionPtr pSpectra = pAnalysis_->GetMSSpectrumCollection();
EDAL::IMSSpectrumPtr pSpectrum = pSpectra->GetItem( long(pos) + 1 ); // 1-origin
if ( pSpectrum->Polarity == EDAL::SpectrumPolarity::IonPolarity_Negative )
ms.setPolarity( adcontrols::MS_POLARITY::PolarityNegative );
else if ( pSpectrum->Polarity == EDAL::SpectrumPolarity::IonPolarity_Positive )
ms.setPolarity( adcontrols::MS_POLARITY::PolarityPositive );
else
ms.setPolarity( adcontrols::MS_POLARITY::PolarityIndeterminate );
adcontrols::MSProperty prop = ms.getMSProperty();
prop.setTimeSinceInjection( static_cast< unsigned long >( pSpectrum->RetentionTime /* sec */ * 1.0e6 ) ); // usec
ms.setMSProperty( prop ); // <- end of prop set
_variant_t vMasses, vIntens;
if ( objId <= 1 ) {
pSpectrum->GetMassIntensityValues( EDAL::SpectrumType_Profile, &vMasses, &vIntens );
ms.setCentroid( adcontrols::CentroidNone ); // profile
} else { // objId should be 2
pSpectrum->GetMassIntensityValues( EDAL::SpectrumType_Line, &vMasses, &vIntens );
ms.setCentroid( adcontrols::CentroidNative );
}
SafeArray sa_masses( vMasses );
ms.resize( sa_masses.size() );
ms.setMassArray( reinterpret_cast< const double *>( sa_masses.p() ) );
SafeArray sa_intensities( vIntens );
ms.setIntensityArray( reinterpret_cast< const double *>( sa_intensities.p() ) );
ms.setAcquisitionMassRange( ms.getMass( 0 ), ms.getMass( ms.size() - 1 ) );
return true;
} catch(_com_error& ex ) {
ADERROR() << std::wstring( ex.ErrorMessage() );
return false;
}
return false;
}
示例2: while
bool
waveform::fft::lowpass_filter( adcontrols::MassSpectrum& ms, double freq )
{
if ( ms.isCentroid() )
return false;
size_t totalSize = ms.size();
(void)totalSize;
size_t N = 32;
while ( N < ms.size() )
N *= 2;
const size_t NN = ms.size();
double sampInterval = ms.getMSProperty().getSamplingInfo().fSampInterval(); // seconds
if ( sampInterval == 0 )
sampInterval = ( ms.getTime( ms.size() - 1 ) - ms.getTime( 0 ) ) / ms.size();
const double T = N * sampInterval; // time full scale in seconds. Freq = n/T (Hz)
// power spectrum has N/2 points and is n/T Hz horizontal axis := data[N/2] = (N/2)/T Hz
size_t cutoff = size_t( T * freq );
adportable::array_wrapper<const double> pIntens( ms.getIntensityArray(), N );
std::vector< std::complex<double> > spc( N );
std::vector< std::complex<double> > fft( N );
size_t n;
for ( n = 0; n < N && n < NN; ++n )
spc[ n ] = std::complex<double>( pIntens[ n ] );
while ( n < N )
spc[ n++ ] = pIntens[ NN - 1 ];
adportable::fft::fourier_transform( fft, spc, false );
// appodization
for ( size_t i = cutoff; i < N - cutoff; ++i )
fft[ i ] = 0;
//adportable::fft::apodization( N/2 - N/16, N / 16, fft );
adportable::fft::fourier_transform( spc, fft, true );
std::vector<double> data( N );
for ( size_t i = 0; i < NN; ++i )
data[ i ] = spc[i].real();
ms.setIntensityArray( &data[0] );
return true;
}
示例3:
//virtual
bool
datafile::getSpectrum( int /* fcn*/, size_t idx, adcontrols::MassSpectrum& ms, uint32_t /* objid */) const
{
if ( lrpfile_ && unsigned( idx ) < lrpfile_->number_of_spectra() ) {
if ( auto msdata = (*lrpfile_)[ idx ] ) {
std::vector< double > time, intens;
if ( lrpfile_->getMS( *msdata, time, intens ) ) {
ms.resize( time.size() );
ms.setMassArray( time.data() );
ms.setIntensityArray( intens.data() );
ms.setAcquisitionMassRange( time.front(), time.back() );
return true;
}
}
}
return false;
}