Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with LSL #23

Open
lucasbenoit opened this issue Mar 17, 2021 · 7 comments
Open

error with LSL #23

lucasbenoit opened this issue Mar 17, 2021 · 7 comments

Comments

@lucasbenoit
Copy link

Hi
I would like to use the mne library to read eeg signal in real time with LSL and the OpenBCI gui.
When I run the script plot_lslclient_rt.py , the terminal tells me that the LSL connection works but closes directly after , the error comes from the function client.start_receive_thread(8) .
Here is my error in the terminal :

"Opening raw data file C:\Users\sc01484\mne_data\MNE-sample-data/MEG/sample/sample_audvis_filt-0-40_raw.fif...
Read a total of 4 projection items:
PCA-v1 (1 x 102) idle
PCA-v2 (1 x 102) idle
PCA-v3 (1 x 102) idle
Average EEG reference (1 x 60) idle
Range : 6450 ... 48149 = 42.956 ... 320.665 secs
Ready.
Reading 0 ... 4505 = 0.000 ... 30.003 secs...
Removing projector <Projection | PCA-v1, active : False, n_channels : 102>
Removing projector <Projection | PCA-v2, active : False, n_channels : 102>
Removing projector <Projection | PCA-v3, active : False, n_channels : 102>
Client: Waiting for server to start
Looking for LSL stream openbcigui...
Found stream 'obci_eeg1' via openbcigui...
Client: Connected
Got epoch 1/100
Exception in thread Thread-9:
Traceback (most recent call last):
File "C:\Users\sc01484\Anaconda3\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\sc01484\Anaconda3\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\sc01484\Anaconda3\lib\site-packages\mne_realtime\base_client.py", line 16, in _buffer_recv_worker
for raw_buffer in client.iter_raw_buffers():
File "C:\Users\sc01484\Anaconda3\lib\site-packages\mne_realtime\lsl_client.py", line 83, in iter_raw_buffers
yield np.vstack(samples).T
File "<array_function internals>", line 5, in vstack
File "C:\Users\sc01484\Anaconda3\lib\site-packages\numpy\core\shape_base.py", line 283, in vstack
return _nx.concatenate(arrs, 0)
File "<array_function internals>", line 5, in concatenate
ValueError: need at least one array to concatenate
Streams closed"

Does anyone have a solution to this error?

@teonbrooks
Copy link
Member

Hi there @lb162215. For the plt_lslclient_rt.py example, it is using the MockLSLClient for the example. I can help point out what you might need to modify it to work with your hardware. How are you currently creating the LSL stream for your openbci?

@lucasbenoit
Copy link
Author

@teonbrooks I deleted the part concerning the MockLSLclient, I changed the host variable to "openbcigui".
Concerning Openbci I do it from the Gui ( v5.0.3) with the networking - LSL function , with a TimeSeries send.

@timonmerk
Copy link
Contributor

Hey @lb162215, the hostname would be in this case the "Stream ID" and not the Name.

I could use the command line with python openbci_lsl.py --stream to create a stream that I could then read using this code:

import mne
from mne.io import read_raw_fif
from mne_realtime import LSLClient

# this is the max wait time in seconds until client connection
wait_max = 5

info = mne.create_info(ch_names = ['Fp1', 'Fp2', 'C3', 'C4', 'T5', 'T6', 'O1', 'O2'], \
                      sfreq=250, ch_types="eeg")

with LSLClient(host="openbci_eeg_id203", info=info, wait_max=wait_max) as client:
    client_info = client.get_measurement_info()
    sfreq = int(client_info['sfreq'])
    print(client_info)
    
    epoch = client.get_data_as_epoch(n_samples=sfreq)

So here you replace the host, channel names and frequency as displayed by openbci_lsl:
grafik

I am happy to help furtheron if this should not work :)

@lucasbenoit
Copy link
Author

@timonmerk Hello, unfortunately I can't use this technique to find out the host name. I don't have the hardware at the moment, I use the playback function of the GUI and I launch the LSL of this one.

@teonbrooks
Copy link
Member

@lb162215 is there an option in the OpenBCI GUI to specify the device id for playback mode?

@timonmerk
Copy link
Contributor

@lucasbenoit
Copy link
Author

@teonbrooks @timonmerk
Yes there is one . I use this id since the beginning , that's called 'obci_eeg1' in my error message . I tried with others ID and it's still doesn't work .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants