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


C++ SignalProperties::Channels方法代码示例

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


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

示例1: 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

示例2: preflightSignal

void
Normalizer::Preflight( const SignalProperties& Input,
                             SignalProperties& Output ) const
{
  if( Parameter( "NormalizerOffsets" )->NumValues() < Input.Channels() )
    bcierr << "The number of entries in the NormalizerOffsets parameter must match "
           << "the number of input channels"
           << endl;
  if( Parameter( "NormalizerGains" )->NumValues() < Input.Channels() )
    bcierr << "The number of entries in the NormalizerGains parameter must match "
           << "the number of input channels"
           << endl;

  ParamRef Adaptation = Parameter( "Adaptation" );
  if( Adaptation->NumValues() < Input.Channels() )
    bcierr << "The number of entries in the Adaptation parameter must match "
           << "the number of input channels"
           << endl;

  bool adaptation = false;
  for( int channel = 0;
      channel < Input.Channels() && channel < Adaptation->NumValues();
      ++channel )
    adaptation |= ( Adaptation( channel ) != none );

  if( adaptation )
  {
    GenericSignal preflightSignal( Input );

    string UpdateTrigger = Parameter( "UpdateTrigger" );
    if( !UpdateTrigger.empty() )
      Expression( UpdateTrigger ).Evaluate( &preflightSignal );

    ParamRef BufferConditions = Parameter( "BufferConditions" );
    if( BufferConditions->NumColumns() > Input.Channels() )
      bcierr << "The number of columns in the BufferConditions parameter "
             << "may not exceed the number of input channels"
             << endl;

    // Evaluate all expressions to test for validity.
    for( int row = 0; row < BufferConditions->NumRows(); ++row )
      for( int col = 0; col < BufferConditions->NumColumns(); ++col )
        Expression( BufferConditions( row, col ) ).Evaluate( &preflightSignal );

    double bufferSize = Parameter( "BufferLength" ).InSampleBlocks();
    if( bufferSize < 1 )
      bciout << "The BufferLength parameter specifies a zero-sized buffer"
             << endl;
  }
  // Request output signal properties:
  Output = Input;
  // Describe output:
  if( adaptation )
    Output.ValueUnit().SetOffset( 0 ).SetGain( 1 ).SetSymbol( "" )
                      .SetRawMin( -2 ).SetRawMax( 2 );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:56,代码来源:Normalizer.cpp

示例3: 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

示例4: 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

示例5: 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

示例6: Preflight

// **************************************************************************
// Function:   Preflight
// Purpose:    Checks parameters for availability and consistency with
//             input signal properties; requests minimally needed properties for
//             the output signal; checks whether resources are available.
// Parameters: Input and output signal properties pointers.
// Returns:    N/A
// **************************************************************************
void FIRFilter::Preflight( const SignalProperties& inSignalProperties,
                                 SignalProperties& outSignalProperties ) const
{
  // Parameter consistency checks: Existence/Ranges and mutual Ranges.
  Parameter( "SamplingRate" );
  PreflightCondition(
    Parameter( "FIRFilteredChannels" ) == Parameter( "FIRFilterKernal" )->NumRows() );
 // PreflightCondition(
 //   Parameter( "SampleBlockSize" ) == Parameter( "FIRFilterKernal" )->GetNumValuesDimension2() );
  PreflightCondition(
     Parameter( "FIRFilterKernal" )->NumRows() <= MAX_M );
  PreflightCondition(
     Parameter( "FIRFilterKernal" )->NumColumns() <= MAX_N );

  // Resource availability checks.
  /* The FIR filter seems not to depend on external resources. */

  // Input signal checks.
  PreflightCondition( Parameter( "FIRFilteredChannels" ) <= inSignalProperties.Channels() );

  // Requested output signal properties.

  if( Parameter( "Integration" ) == 0 )
  {

         PreflightCondition( Parameter( "FIRFilterKernal" )->NumColumns() ==
           ( Parameter( "FIRWindows" ) -1 ) * Parameter( "SampleBlockSize" ) + 1 );

         outSignalProperties = SignalProperties( inSignalProperties.Channels(), Parameter( "SampleBlockSize" ) );
  }
  else
  {
        PreflightCondition( Parameter( "FIRFilterKernal" )->NumColumns() <=
           ( Parameter( "FIRWindows" ) -1 ) * Parameter( "SampleBlockSize" ) + 1 );

         outSignalProperties = SignalProperties( inSignalProperties.Channels(), 1 );
  }
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:46,代码来源:FIRFilter.cpp

示例7: Channels

void
EDFOutputFormat::Initialize( const SignalProperties& inProperties,
                             const StateVector& inStatevector )
{
  EDFOutputBase::Initialize( inProperties, inStatevector );
  // Adapt marker channels to EDF conventions.
  for( size_t i = inProperties.Channels(); i < Channels().size(); ++i )
  {
    Channels()[ i ].DigitalMinimum = 0;
    Channels()[ i ].DigitalMaximum = static_cast<int>( Channels()[ i ].DigitalMaximum - 1 ) & 0x7fff;
    Channels()[ i ].PhysicalMinimum = Channels()[ i ].DigitalMinimum;
    Channels()[ i ].PhysicalMaximum = Channels()[ i ].DigitalMaximum;
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:14,代码来源:EDFOutputFormat.cpp

示例8: Channels

void
EDFFileWriter::Initialize( const SignalProperties& Input,
                           const SignalProperties& Output )
{
    EDFFileWriterBase::Initialize( Input, Output );
    // Adapt marker channels to EDF conventions.
    for( size_t i = Input.Channels(); i < Channels().size(); ++i )
    {
        Channels()[ i ].DigitalMinimum = 0;
        Channels()[ i ].DigitalMaximum = int( Channels()[ i ].DigitalMaximum - 1 ) & 0x7fff;
        Channels()[ i ].PhysicalMinimum = Channels()[ i ].DigitalMinimum;
        Channels()[ i ].PhysicalMaximum = Channels()[ i ].DigitalMaximum;
    }
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:14,代码来源:EDFFileWriter.cpp

示例9: 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

示例10: Parameter

void
AlignmentFilter::Initialize( const SignalProperties& Input,
                             const SignalProperties& /*Output*/ )
{
  mPrevSample.clear();
  mWeightPrev.clear();
  mWeightCur.clear();

  // Do we want to align the samples in time ?
  mAlign = ( Parameter( "AlignChannels" ) == 1 );
  if( mAlign )
  {
    mPrevSample.resize( Input.Channels(), 0.0 );
    mWeightPrev.resize( Input.Channels(), 0.0 );
    mWeightCur.resize( Input.Channels(), 1.0 );

    // Calculate weight values for linear interpolation if we do not use the default value.
    if( Parameter( "SourceChTimeOffset" )->NumValues() > 0 )
    {
      for( int i = 0; i < Input.Channels(); ++i ) // get original channel position
      {
        mWeightPrev[ i ] = Parameter( "SourceChTimeOffset" )( i );
        mWeightCur[ i ] = 1.0 - mWeightPrev[ i ];
      }
    }
    // If we do use the default value, assume that all sampled channels are evenly distributed in time.
    else
    {
      float delta = 1.0 / Input.Channels();
      for( int i = 0; i < Input.Channels(); ++i ) // get original channel position
      {
        mWeightPrev[ i ] = delta * i;
        mWeightCur[ i ] = 1.0 - mWeightPrev[ i ];
      }
    }
  }
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:37,代码来源:AlignmentFilter.cpp

示例11: if

void
BufferedADC::Preflight( const SignalProperties&,
                        SignalProperties& Output ) const
{
    if( Parameter( "SourceBufferSize" ).InSampleBlocks() < 2 )
        bcierr << "The SourceBufferSize parameter must be greater or"
               << " equal 2 sample blocks."
               << endl;
    State( "SourceTime" );
    State( "Running" );
    mAcquisitionProperties = Output;
    this->OnPreflight( mAcquisitionProperties );
    Output = mAcquisitionProperties;
    int numStateChannels = 0;
    for( int ch = 0; ch < Output.Channels(); ++ch )
    {
        bool isStateChannel = ( *Output.ChannelLabels()[ch].c_str() == StateMark );
        if( numStateChannels && !isStateChannel )
            bcierr_ << "State channels must be located at the end of the channel list";
        else if( isStateChannel )
            ++numStateChannels;
    }
    Output.SetChannels( Output.Channels() - numStateChannels );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:24,代码来源:BufferedADC.cpp

示例12: 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

示例13: Parameter

void
Normalizer::Initialize( const SignalProperties& Input,
                        const SignalProperties& /*Output*/ )
{
  mOffsets.clear();
  mGains.clear();

  delete mpUpdateTrigger;
  mpUpdateTrigger = NULL;

  mBufferConditions.clear();
  mDataBuffers.clear();

  ParamRef Adaptation = Parameter( "Adaptation" ),
           NormalizerOffsets = Parameter( "NormalizerOffsets" ),
           NormalizerGains = Parameter( "NormalizerGains" );

  mAdaptation.clear();
  mDoAdapt = false;
  for( int channel = 0; channel < Input.Channels(); ++channel )
  {
    mOffsets.push_back( NormalizerOffsets( channel ) );
    mGains.push_back( NormalizerGains( channel ) );
    mAdaptation.push_back( int( Adaptation( channel ) ) );
    mDoAdapt |= ( Adaptation( channel ) != none );
  }
  if( mDoAdapt )
  {
    string UpdateTrigger = Parameter( "UpdateTrigger" );
    if( !UpdateTrigger.empty() )
      mpUpdateTrigger = new Expression( UpdateTrigger );

    size_t bufferSize = static_cast<size_t>( Parameter( "BufferLength" ).InSampleBlocks() * Input.Elements() );
    ParamRef BufferConditions = Parameter( "BufferConditions" );
    mBufferConditions.resize( BufferConditions->NumColumns() );
    for( int col = 0; col < BufferConditions->NumColumns(); ++col )
      for( int row = 0; row < BufferConditions->NumRows(); ++row )
        mBufferConditions[ col ].push_back( Expression( BufferConditions( row, col ) ) );
    mDataBuffers.resize(
      BufferConditions->NumColumns(),
      vector<RingBuffer>( BufferConditions->NumRows(), RingBuffer( bufferSize ) )
    );
    bcidbg << "Allocated " << mDataBuffers.size()
           << "x" << ( mDataBuffers.empty() ? 0 : mDataBuffers[ 0 ].size() )
           << " data buffers of size " << bufferSize << "."
           << endl;
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:48,代码来源:Normalizer.cpp

示例14: 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

示例15: 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


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