本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);*/
}
示例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);
}
示例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;
}
}
}
});
}
}
示例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));
}