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


Java Eeg类代码示例

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


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

示例1: FrequencyBandViewModel

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
public FrequencyBandViewModel(StreamingDeviceViewModel device, Band band, ValueType type) {
  museType = FrequencyBands.toMuseType(band, type);

  // Add listener to streaming device, use new values to update timeseries.
  // TODO: Unregister when device stops, or on disposal.
  device.registerDataListenerWhenConnected(new BaseDataPacketListener() {
    @Override public void receiveMuseDataPacket(MuseDataPacket museDataPacket, Muse muse) {
      FrequencyBandViewModel.this.updateValues(
          museDataPacket.timestamp(),
          museDataPacket.getEegChannelValue(Eeg.EEG1),
          museDataPacket.getEegChannelValue(Eeg.EEG2),
          museDataPacket.getEegChannelValue(Eeg.EEG3),
          museDataPacket.getEegChannelValue(Eeg.EEG4)
      );
    }
  }, museType);
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:18,代码来源:FrequencyBandViewModel.java

示例2: SensorGoodViewModel

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
/** Creates the VM by updating from the device's isGood status. */
public SensorGoodViewModel(StreamingDeviceViewModel deviceVM) {
  deviceVM.registerDataListenerWhenConnected(new BaseDataPacketListener() {
    @Override
    public void receiveMuseDataPacket(MuseDataPacket museDataPacket, Muse muse) {
      updateConnectionState(
          museDataPacket.getEegChannelValue(Eeg.EEG1) > 0,
          museDataPacket.getEegChannelValue(Eeg.EEG2) > 0,
          museDataPacket.getEegChannelValue(Eeg.EEG3) > 0,
          museDataPacket.getEegChannelValue(Eeg.EEG4) > 0
      );
    }
  }, MuseDataPacketType.IS_GOOD);
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:15,代码来源:SensorGoodViewModel.java

示例3: RawChannelViewModel

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
public RawChannelViewModel(StreamingDeviceViewModel device, final Eeg channel, long maxAgeMS) {
  super(maxAgeMS);

  // Add listener to streaming device, use new values to update timeseries.
  // TODO: Unregister when device stops, or on disposal.
  device.registerDataListenerWhenConnected(new BaseDataPacketListener() {
    @Override public void receiveMuseDataPacket(MuseDataPacket museDataPacket, Muse muse) {
      double rawValue = museDataPacket.getEegChannelValue(channel);
      RawChannelViewModel.this.pushValue(museDataPacket.timestamp(), rawValue);
    }
  }, MuseDataPacketType.EEG);
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:13,代码来源:RawChannelViewModel.java

示例4: ConnectionStrengthViewModel

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
/** Creates the VM by updating from the device's HSI values. */
public ConnectionStrengthViewModel(StreamingDeviceViewModel deviceVM) {
  deviceVM.registerDataListenerWhenConnected(new BaseDataPacketListener() {
    @Override public void receiveMuseDataPacket(MuseDataPacket museDataPacket, Muse muse) {
      updateConnectionState(
          museDataPacket.timestamp(),
          museDataPacket.getEegChannelValue(Eeg.EEG1),
          museDataPacket.getEegChannelValue(Eeg.EEG2),
          museDataPacket.getEegChannelValue(Eeg.EEG3),
          museDataPacket.getEegChannelValue(Eeg.EEG4)
      );
    }
  }, MuseDataPacketType.HSI_PRECISION);
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:15,代码来源:ConnectionStrengthViewModel.java

示例5: LoadEEGValues

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
public void LoadEEGValues() {
	eegValues = new double[4];
	eegValues[0] = basePacket.getEegChannelValue(Eeg.EEG1);
	eegValues[1] = basePacket.getEegChannelValue(Eeg.EEG2);
	eegValues[2] = basePacket.getEegChannelValue(Eeg.EEG3);
	eegValues[3] = basePacket.getEegChannelValue(Eeg.EEG4);
	/*eegValues[4] = basePacket.getEegChannelValue(Eeg.AUX_LEFT);
	eegValues[5] = basePacket.getEegChannelValue(Eeg.AUX_RIGHT);*/
}
 
开发者ID:Venryx,项目名称:react-native-libmuse,代码行数:10,代码来源:VMuseDataPacket.java

示例6: createRawTimeSeries

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
/** @return A new live VM for a single time series from a raw data channel. */
public RawChannelViewModel createRawTimeSeries(final Eeg channel, int durationSec) {
  return new RawChannelViewModel(this, channel, durationSec * 1000L);
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:5,代码来源:StreamingDeviceViewModel.java

示例7: onCreate

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // Initialize Muse first up.
  MuseManagerAndroid.getInstance().setContext(this);

  // Bind viewmodel to the view.
  ActivityDeviceDetailsBinding binding =
      DataBindingUtil.setContentView(this, R.layout.activity_device_details);
  binding.setDeviceVM(deviceVM);
  binding.setIsGoodVM(new SensorGoodViewModel(deviceVM));
  binding.setConnectionVM(new ConnectionStrengthViewModel(deviceVM));
  binding.setRawVM(  deviceVM.createRawTimeSeries(Eeg.EEG3, DURATION_SEC));
  binding.setThetaVM(deviceVM.createFrequencyLiveValue(Band.THETA, ValueType.SCORE));
  binding.setDeltaVM(deviceVM.createFrequencyLiveValue(Band.DELTA, ValueType.SCORE));
  binding.setAlphaVM(deviceVM.createFrequencyLiveValue(Band.ALPHA, ValueType.SCORE));
  binding.setBetaVM( deviceVM.createFrequencyLiveValue(Band.BETA,  ValueType.SCORE));

  // Bind action bar, seems like this can't be done in the layout :(
  deviceVM.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
    @Override
    public void onPropertyChanged(Observable sender, int propertyId) {
      DeviceDetailsActivity.this.getSupportActionBar().setTitle(
          String.format("%s: %s", deviceVM.getName(), deviceVM.getConnectionState())
      );
    }
  });

  // And attach the desired muse to the VM once connected.
  final String macAddress = getIntent().getExtras().getString("mac");
  if (macAddress != null) {
    MuseManagerAndroid.getInstance().startListening();
    MuseManagerAndroid.getInstance().setMuseListener(new MuseListener() {
      @Override
      public void museListChanged() {
        for (Muse muse : MuseManagerAndroid.getInstance().getMuses()) {
          if (macAddress.equals(muse.getMacAddress())) {
            DeviceDetailsActivity.this.deviceVM.setMuse(muse);
            MuseManagerAndroid.getInstance().stopListening();
            break;
          }
        }
      }
    });
  }
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:48,代码来源:DeviceDetailsActivity.java

示例8: onCreate

import com.choosemuse.libmuse.Eeg; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  // Initialize Muse first up.
  MuseManagerAndroid.getInstance().setContext(this);

  // Bind viewmodel to the view.
  ActivityMoreDeviceDetailsBinding binding =
      DataBindingUtil.setContentView(this, R.layout.activity_more_device_details);
  binding.setDeviceVM(deviceVM);
  binding.setEpochs(epochCollector);

  // Bind action bar, seems like this can't be done in the layout :(
  deviceVM.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
    @Override
    public void onPropertyChanged(Observable sender, int propertyId) {
      MoreDeviceDetailsActivity.this.getSupportActionBar().setTitle(
          String.format("%s: %s", deviceVM.getName(), deviceVM.getConnectionState())
      );
    }
  });

  // Attach the desired muse to the VM once connected.
  final String macAddress = getIntent().getExtras().getString("mac");
  MuseManagerUtil.getByMacAddress(macAddress, new MuseManagerUtil.MuseCallback() {
    @Override
    public void museFound(Muse muse) {
      Log.i(Constants.TAG, "SETTING MUSE");
      MoreDeviceDetailsActivity.this.deviceVM.setMuse(muse);
    }
  });

  // Add frequency listeners to the 2D plot:
  FrequencyBandViewModel relativeTheta = deviceVM.createFrequencyLiveValue(
      FrequencyBands.Band.THETA, FrequencyBands.ValueType.SCORE);
  FrequencyBandViewModel relativeBeta = deviceVM.createFrequencyLiveValue(
      FrequencyBands.Band.BETA, FrequencyBands.ValueType.SCORE);
  TimeSeries<Double[]> plotTimeSeries = TimeSeries.fromLiveSeries(
      new MergedSeries(relativeTheta, relativeBeta), DURATION_SEC * 1000
  );
  plot2DView = (Plot2DView) findViewById(R.id.tbr2DPlot);
  plot2DView.setTimeSeries(plotTimeSeries);

  // Add raw listeners for the epoch collector:
  epochCollector.addSource("3", deviceVM.createRawTimeSeries(Eeg.EEG3, 2));
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:48,代码来源:MoreDeviceDetailsActivity.java


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