from ble2lsl.devices import muse2016
from wizardhat import acquire, transform

import numpy as np
import matplotlib.pyplot as plt

#if we had a device with us, we would use:
#streamer = ble2lsl.Streamer(muse2016)
#but if you're debugging or learning, use the dummy streamer with the command below:
streamer = ble2lsl.Dummy(muse2016)

#After writing streamer. you can use the tab key to see a list of properties and methods that streamer has,
#for example, streamer.subscriptions shows all the subscribed data streams that the streamer object has picked up
#from the device.
streamer.subscriptions
receiver = acquire.Receiver()
receiver.buffers
receiver.ch_names
receiver.buffers['EEG'].data
receiver.buffers['EEG'].data.shape
#the default window for seeing data is 10 seconds. You can change that when you call acquire.Receiver(window=15) etc
receiver.buffers['EEG'].unstructured
#this version of the data has no labels and is just a pure numpy matrix
receiver.buffers['EEG'].get_timestamps()
our_first_recording = receiver.record(5)
#wait 5 seconds after running this command
our_first_recording.buffers['EEG'].data
#notice it only goes up to 5 seconds
channel_to_view = 'TP9'
samples_to_view = 2000
raw = receiver.buffers['EEG'].data[channel_to_view][-samples_to_view:]
Пример #2
0
def construct_receiver_no_id(source_id=None, **kwargs):
    """Used to force manual selection among multiple sources."""
    return acquire.Receiver(source_id=None, **kwargs)