当前位置: 首页>>代码示例>>C++>>正文


C++ SignalProperties类代码示例

本文整理汇总了C++中SignalProperties的典型用法代码示例。如果您正苦于以下问题:C++ SignalProperties类的具体用法?C++ SignalProperties怎么用?C++ SignalProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SignalProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Channels

void
WindowingThread::OnInitialize( const SignalProperties& Input,
                               const SignalProperties& Output )
{
  size_t numSamples = Output.Elements();
  mBuffers.clear();
  mBuffers.resize( Channels().size(), DataVector( numSamples ) );
  mInputElements = Input.Elements();

  mDetrend = Parameter( "Detrend" );
  if( mDetrend == None )
    mDetrendBuffer.resize( 0 );
  else
    mDetrendBuffer.resize( numSamples );

  mWindowFunction = Parameter( "WindowFunction" );
  mWindow.resize( numSamples );
  Real phasePerSample = M_PI / numSamples;
  // Window coefficients: Rect Hamming Hann Blackman
  const Real a1[] = {    0,   0.46,  0.5, 0.5, },
             a2[] = {    0,   0,     0,   0.08 };
  for( size_t i = 0; i < numSamples; ++i )
    mWindow[i] = 1 - a1[mWindowFunction] - a2[mWindowFunction]
                   + a1[mWindowFunction] * cos( i * phasePerSample )
                   + a2[mWindowFunction] * cos( i * 2 * phasePerSample );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:26,代码来源:WindowingFilter.cpp

示例2: Parameter

void
TSWFilter::Preflight( const SignalProperties& Input,
                            SignalProperties& Output ) const
{
#if 0
  if( Parameter( "YMean" ) != 0 )
    bciout << "YMean should be set to zero for Slow Waves" << endl;
  if( Parameter( "YGain" ) < 300 || Parameter( "YGain" ) > 400 )
    bciout << "YGain should be set to 327.68 for Slow Waves" << endl;
#endif
  Parameter( "FeedbackEnd" );
  State( itiStateName );

  if( Parameter( "SWOutChList" )->NumValues() != Parameter( "SWInChList" )->NumValues() )
    bcierr << "The number of entries in SWOutChList must match that in SWInChList"
           << endl;
  for( int i = 0; i < Parameter( "SWInChList" )->NumValues(); ++i )
    PreflightCondition( Parameter( "SWInChList" )( i ) > 0 && Parameter( "SWInChList" )( i ) <= Input.Channels() );
  for( int i = 0; i < Parameter( "SWOutChList" )->NumValues(); ++i )
    PreflightCondition( Parameter( "SWOutChList" )( i ) > 0 && Parameter( "SWOutChList" )( i ) <= Input.Channels() );
  PreflightCondition( Parameter( "Tc" ).InSampleBlocks() >= 0.0 );
  PreflightCondition( Parameter( "SpatialFilteredChannels" ) == Input.Channels() );
  Output = SignalProperties( Input.Channels(), 1 );
  Output.SetName( "SWFiltered" );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:25,代码来源:SWFilter.cpp

示例3: PreflightCondition

void
TFBArteCorrection::Preflight( const SignalProperties& inSignalProperties,
                                    SignalProperties& outSignalProperties ) const
{
  for( int i = 0; i < Parameter( "ArteChList" )->NumValues(); ++i )
  {
    PreflightCondition( Parameter( "ArteChList" )( i ) >= 0 );
    PreflightCondition( Parameter( "ArteChList" )( i ) <= inSignalProperties.Channels() );
  }
  outSignalProperties = inSignalProperties;
  outSignalProperties.SetName( "Artifact Filtered" );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:12,代码来源:FBArteCorrection.cpp

示例4: Parameter

void
CustomFIRFilter::Initialize( const SignalProperties& Input, const SignalProperties& /*Output*/ )
{
  mBuffer.clear();

  ParamRef FIRCoefficients = Parameter( "FIRCoefficients" );
  int filterLength = FIRCoefficients->NumValues();
  mFilter.resize( filterLength, 0.0 );
  for( int sample = 0; sample < filterLength; ++sample )
    mFilter[sample] = FIRCoefficients( sample );

  int bufferLength = filterLength + Input.Elements() - 1;
  mBuffer.resize( Input.Channels(), DataVector( 0.0, bufferLength ) );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:14,代码来源:CustomFIRFilter.cpp

示例5:

bool
SignalProperties::Accommodates( const SignalProperties& sp ) const
{
  if( sp.IsEmpty() )
    return true;
  if( IsEmpty() )
    return false;
  if( !SignalType::ConversionIsSafe( sp.Type(), Type() ) )
    return false;
  if( Elements() < sp.Elements() )
    return false;
  if( Elements() < sp.Elements() )
    return false;
  return true;
}
开发者ID:SproutOrc,项目名称:BiteProc,代码行数:15,代码来源:SignalProperties.cpp

示例6: Parameter

void
ARThread::OnInitialize( const SignalProperties& Input, const SignalProperties& Output )
{
  mMEMPredictor.SetModelOrder( Parameter( "ModelOrder" ) );
  mOutputType = Parameter( "OutputType" );
  if( mOutputType != Coefficients )
  {
    mTransferSpectrum.SetFirstBinCenter( Parameter( "FirstBinCenter" ).InHertz() / Input.SamplingRate() );
    mTransferSpectrum.SetBinWidth( Parameter( "BinWidth" ).InHertz() / Input.SamplingRate() );
    mTransferSpectrum.SetNumBins( Output.Elements() );
    mTransferSpectrum.SetEvaluationsPerBin( Parameter( "EvaluationsPerBin" ) );
    mSpectrum.resize( Output.Elements() );
  }
  mInput.resize( Input.Elements() );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:15,代码来源:ARSpectrum.cpp

示例7: PreflightCondition

void
AverageDisplay::Preflight( const SignalProperties& Input, SignalProperties& Output ) const
{
  PreflightCondition( Parameter( "AvgDisplayCh" )->NumColumns() >= 2 );
  for( int i = 0; i < Parameter( "AvgDisplayCh" )->NumRows(); ++i )
    PreflightCondition
    (
      Parameter( "AvgDisplayCh" )( i, 0 ) > 0
      && Parameter( "AvgDisplayCh" )( i, 0 ) <= Input.Channels()
    );
  PreflightCondition( Parameter( "SamplingRate" ) > 0 );
  PreflightCondition( Input.Elements() > 0 );
  State( "TargetCode" );
  Output = Input;
}
开发者ID:sonyyassine,项目名称:weka-bci2000,代码行数:15,代码来源:AverageDisplay.cpp

示例8: startRunExpression

void
ExpressionFilter::Preflight( const SignalProperties& Input,
                                   SignalProperties& Output ) const
{
  // Test whether configuration can be loaded.
  LCRandomGenerator rg;
  Expr startRunExpression( rg, Parameter( "StartRunExpression" ) ),
       stopRunExpression( rg, Parameter( "StopRunExpression" ) );
  ExpressionMatrix expressions;
  LoadExpressions( Parameter( "Expressions" ), expressions, rg );
  VariableContainer variables;
  // Request output signal properties:
  Output = Input;
  size_t numRows = expressions.size(),
         numCols = numRows ? expressions[0].size() : 0;
  if( numCols != 0 )
    Output.SetChannels( numRows )
          .SetElements( numCols )
          .ElementUnit().SetGain( 1.0 ).SetOffset( 0.0 ).SetSymbol( "" );
  // Try evaluating expressions.
  startRunExpression.Compile( variables );
  startRunExpression.Evaluate();
  GenericSignal preflightInput( Input ), preflightOutput( Output );
  CompileExpressions( expressions, variables );
  EvaluateExpressions( expressions, &preflightInput, &preflightOutput );
  stopRunExpression.Compile( variables );
  stopRunExpression.Evaluate();
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:28,代码来源:ExpressionFilter.cpp

示例9: Parameter

void
ARFilter::Initialize( const SignalProperties& Input,
                      const SignalProperties& /*Output*/ )
{
  int windowLength = MeasurementUnits::ReadAsTime( Parameter( "WindowLength" ) )
                     * Parameter( "SampleBlockSize" );
  mBuffer.clear();
  mBuffer.resize( Input.Channels(), DataVector( 0.0, windowLength ) );

  mOutputType = Parameter( "OutputType" );
  mDetrend = Parameter( "Detrend" );
  mMEMPredictor.SetModelOrder( Parameter( "ModelOrder" ) );

  switch( mOutputType )
  {
    case SpectralAmplitude:
    case SpectralPower:
    {
      float firstBinCenter = MeasurementUnits::ReadAsFreq( Parameter( "FirstBinCenter" ) ),
            lastBinCenter = MeasurementUnits::ReadAsFreq( Parameter( "LastBinCenter" ) ),
            binWidth = MeasurementUnits::ReadAsFreq( Parameter( "BinWidth" ) );
      int outputElements = ::floor( ( lastBinCenter - firstBinCenter + eps ) / binWidth + 1 );
      mTransferSpectrum
        .SetFirstBinCenter( firstBinCenter )
        .SetBinWidth( binWidth )
        .SetNumBins( outputElements )
        .SetEvaluationsPerBin( Parameter( "EvaluationsPerBin" ) );

    } break;

    case ARCoefficients:
      break;
  }
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:34,代码来源:ARFilter.cpp

示例10: Parameter

void
ComplexDemodulator::Preflight( const SignalProperties& Input,
                                     SignalProperties& Output ) const
{
  ParamRef DemodulatorFrequencies = Parameter( "DemodulatorFrequencies" );
  bool error = false;
  for( int i = 0; i < DemodulatorFrequencies->NumValues(); ++i )
  {
    double frequency = MeasurementUnits::ReadAsFreq( DemodulatorFrequencies( i ) );
    error |= ( frequency < 0 );
    error |= ( frequency > 0.5 );
  }
  if( error )
    bcierr << "DemodulatorFrequencies must be greater 0 and less than half the "
           << "sampling rate "
           << "(currently " << Parameter( "SamplingRate" ) << "Hz)"
           << endl;
  double FrequencyResolution
    = MeasurementUnits::ReadAsFreq( Parameter( "FrequencyResolution" ) );
  PreflightCondition( FrequencyResolution > 0 );

  // Request output signal properties:
  Output = SignalProperties(
            Input.Channels(),
            DemodulatorFrequencies->NumValues(),
            SignalType::float32
           );
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:28,代码来源:ComplexDemodulator.cpp

示例11: Parameter

void
SpatialFilter::Preflight( const SignalProperties& Input,
                                SignalProperties& Output ) const
{
  // Parameter/Input consistency.
  if( Input.Channels() != Parameter( "SpatialFilter" )->NumColumns() )
    bcierr << "The input signal's number of channels must match "
           << "the number of columns in the SpatialFilter parameter"
           << endl;

  // Output signal description.
  Output = Input;
  Output.SetChannels( 0 ).SetChannels( Parameter( "SpatialFilter" )->NumRows() );
  if( !Parameter( "SpatialFilter" )->RowLabels().IsTrivial() )
    for( int i = 0; i < Parameter( "SpatialFilter" )->NumRows(); ++i )
      Output.ChannelLabels()[ i ] = Parameter( "SpatialFilter" )->RowLabels()[ i ];
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:17,代码来源:SpatialFilter.cpp

示例12: Parameter

void
WindowingThread::OnPreflight( const SignalProperties& Input,
                                    SignalProperties& Output ) const
{
  Output = Input;
  double windowLength = Parameter( "WindowLength" ).InSampleBlocks();
  int numSamples = static_cast<int>( windowLength * Input.Elements() );
  if( numSamples < 0 )
  {
    bcierr << "WindowLength parameter must be >= 0" << endl;
    numSamples = 0;
  }
  Output.SetElements( numSamples )
        .SetIsStream( false )
        .ElementUnit().SetRawMin( 0 )
                      .SetRawMax( Output.Elements() - 1 );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:17,代码来源:WindowingFilter.cpp

示例13: Parameter

void
LinearClassifier::Initialize( const SignalProperties& Input,
                              const SignalProperties& /*Output*/ )
{
  const ParamRef& Classifier = Parameter( "Classifier" );
  size_t numEntries = Classifier->NumRows();
  mInputChannels.resize( numEntries );
  mInputElements.resize( numEntries );
  mOutputChannels.resize( numEntries );
  mWeights.resize( numEntries );
  for( size_t entry = 0; entry < numEntries; ++entry )
  {
    mInputChannels[ entry ] = Input.ChannelIndex( Classifier( entry, 0 ) );
    mInputElements[ entry ] = Input.ElementIndex( Classifier( entry, 1 ) );
    mOutputChannels[ entry ] = Classifier( entry, 2 ) - 1;
    mWeights[ entry ] = Classifier( entry, 3 );
  }
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:18,代码来源:LinearClassifier.cpp

示例14: Parameter

void
FFTFilter::Preflight( const SignalProperties& Input, SignalProperties& Output ) const
{
  for( int i = 0; i < Parameter( "FFTInputChannels" )->NumValues(); ++i )
  {
    int channelIndex = Input.ChannelIndex( Parameter( "FFTInputChannels" )( i ) );
    if( channelIndex < 0 || channelIndex >= Input.Channels() )
      bcierr << "Invalid channel specification \""
             << Parameter( "FFTInputChannels" )( i )
             << "\" in FFTInputChannels, evaluates to "
             << channelIndex
             << endl;
  }

  bool fftRequired = ( ( int )Parameter( "FFTOutputSignal" ) != eInput
                       || ( int )Parameter( "VisualizeFFT" ) )
                     && ( Parameter( "FFTInputChannels" )->NumValues() > 0 );
  if( fftRequired )
  {
    if( mFFT.LibAvailable() )
    {
      FFTLibWrapper preflightFFT;
      int fftWindowLength = Parameter( "SampleBlockSize" )
                            * MeasurementUnits::ReadAsTime( Parameter( "FFTWindowLength" ) );
      if( !preflightFFT.Initialize( fftWindowLength ) )
        bcierr << "Requested parameters are not supported by FFT library" << endl;
    }
    else
      bcierr << "The FFT Filter could not find the " << mFFT.LibName() << " library. "
             << "For legal reasons, this library is not part of the BCI2000 distribution. "
             << "Please download the latest version of fftw3.dll from "
             << "http://www.fftw.org/install/windows.html"
             << endl;
  }

  if( int( Parameter( "VisualizeFFT" ) ) )
  {
    SignalProperties temp;
    DetermineSignalProperties( temp, ePower );
  }

  Output = Input;
  DetermineSignalProperties( Output, Parameter( "FFTOutputSignal" ) );
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:44,代码来源:FFTFilter.cpp

示例15: Parameter

void
BCI2000OutputFormat::Preflight( const SignalProperties& inProperties,
                                const StateVector& ) const
{
  Parameter( "SourceCh" );

  switch( inProperties.Type() )
  {
    case SignalType::int16:
    case SignalType::int32:
    case SignalType::float32:
      /* These types are OK */
      break;

    default:
      bcierr << inProperties.Type().Name()
             << " data type unsupported for BCI2000 files"
             << endl;
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:20,代码来源:BCI2000OutputFormat.cpp


注:本文中的SignalProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。