Exemplo n.º 1
0
def thread_test():
    streamer = ble2lsl.Streamer(muse2016)
    info = getStream_info(muse2016)
    #runFunc(functions.fft, argsToRun={'input_stream':info, 'output_stream_name':'test'})
    runFunc(functionToRun=functions.plotTimeDomain,
            argsToRun={
                'stream_info': info,
                'channels': 2,
                'timewin': 15
            })
    streamer.stop()
Exemplo n.º 2
0
def connect_muse():
    '''
    connects to any available muse headset.
    returns ble2lsl.ble2lsl.Streamer object.
    '''

    try:
        import ble2lsl
        from ble2lsl.devices import muse2016
    except ImportError:
        raise ImportError("ble2lsl is not installed. \n"
                          "ble2lsl is used to connect to muse devices.\n"
                          "you can install it using `pip install ble2lsl`")

    return ble2lsl.Streamer(muse2016)
Exemplo n.º 3
0
import ble2lsl
from ble2lsl.devices import muse2016
from wizardhat import acquire, transform

import numpy as np
import matplotlib.pyplot as plt

streamer = ble2lsl.Streamer(muse2016)

streamer.subscriptions

receiver = acquire.Receiver()

receiver.buffers

receiver.ch_names

receiver.buffers['EEG'].data

receiver.buffers['EEG'].data.shape

receiver.buffers['EEG'].unstructured

receiver.buffers['EEG'].get_timestamps()

our_first_recording = receiver.record(10)

our_first_recording.buffers['EEG'].data

raw = receiver.buffers['EEG'].data[-channel_to_view][-samples_to_view:]
time_raw = receiver.buffers['EEG'].data['time'][-samples_to_view:]
Exemplo n.º 4
0
    args = parser.parse_args()
    """ 1. CONNECT TO EEG STREAM """
    streamChoice = int(input("1: Dummy Source\n2: Connect to a Muse\n"))
    print(type(streamChoice))

    # Choice to test with dummy stream
    if streamChoice == 1:
        print("Initializing Dummy stream\n")
        device = muse2016
        dummy_outlet = ble2lsl.Dummy(device)

    # Choice to connect muse
    else:
        device = muse2016
        print('Looking for an EEG stream...')
        outlet = ble2lsl.Streamer(device)

    time.sleep(0.25)
    # Search for active LSL stream
    streams = resolve_byprop('type', 'EEG', timeout=2)
    if len(streams) == 0:
        raise RuntimeError('Can\'t find EEG stream.')

    # Set active EEG stream to inlet and apply time correction
    print(
        "Start acquiring data. Have your eyes open and don't move!\n\(• ◡ •)/\n"
    )
    inlet = StreamInlet(streams[0], max_chunklen=12)
    eeg_time_correction = inlet.time_correction()

    # Get the stream info, description, sampling frequency, number of channels
Exemplo n.º 5
0
def fft_test(
):  #dont need a thread as the threading is in the backend (of course)
    stream = ble2lsl.Streamer(muse2016)
    info_ = getStream_info(muse2016)
    functions.fft(info_, output_stream_name='test_stream')
Exemplo n.º 6
0
"""Plot time series data streamed through a dummy LSL outlet.
"""

import ble2lsl
from ble2lsl.devices import muse2016, ganglion
from wizardhat import acquire, plot

import pylsl as lsl

device = muse2016
plot_stream = 'EEG'

if __name__ == '__main__':
    streamer = ble2lsl.Streamer(device)
    receiver = acquire.Receiver()
    plot.Lines(receiver.buffers[plot_stream])