Closed jdpigeon closed 4 years ago
Working through a jupyter notebook for P300 in Python==3.6 , Everything working, connects to muse, Streaming... and then immediately Disconnects. Any ideas?
That's an issue we've encountered a lot before, stemming from the failure of pygatt on OSX to start receiving data once a BLE connection has been opened. Unfortunately, I don't have a solution, but @amandakeasson is the world expert on getting muse-lsl working on Mac.
@amandakeasson, do you know anything that might help?
Hi! Yes, my fork of the eeg-notebooks repo includes instructions for how to get muse-lsl working on Macs (see https://github.com/amandakeasson/eeg-notebooks/blob/master/notebooks/mac_notebook.ipynb).
I'll also make a pull request to add the Mac files to NeurotechX eeg-notebooks.
thanks Amanda, can you describe in more detail what the differences are, have you changed the muselsl code in some way?
I know about the version differences and why you are using the different conda environment to run the experiment and data viz, but I am getting stuck on the previous step, the connecting, have you changed that code?
That code has not been changed. A lot of the Mac issues just had to do with certain versions of different packages not working on Macs, and I had to change the process for starting the recordings for the experiment and EEG simultaneously.
If you follow the instructions here https://github.com/amandakeasson/eeg-notebooks/blob/master/mac_instructions_general.docx then hopefully everything will work. We've done tests on multiple Macs and so far we've only had issues with one computer, and in that case the Muse wouldn't connect at all.
got it, that worked thank you , connected
great to hear!
hey guys, great code, I made a new cueing task I am going to run with my class, you can find the fork of Amanda's code here:
https://github.com/kylemath/eeg-notebooks
I made a minor change to the mac running script in order to save the files with subject name and session, and pass on subject name and number to the cueing task for the behavioural data file
Hi @kylemath, looks great!
I am very new to python, and I currently having the same issue @kylemath had before, it was connected to muse and streaming... but soon got disconnected. When I tried @amandakeasson 's fork, the code failed at it says that
" Failed building wheel for scikit-learn"
then it went on and poped out
"Failed to build scikit-learn pandas muselsl 1.0.1 has requirement pygatt==3.1.1, but you'll have pygatt 3.2.0 which is incompatible. pytest-xdist 1.28.0 has requirement pytest>=4.4.0, but you'll have pytest 4.0.2 which is incompatible."
I have no idea what happened, can anyone tell me the cause?
That's a rather frustrating but solveable dependency mismatch issue.
First, I'd love to see if the regular eeg notebooks installation process works for you based on muse LSL updates we've made at this point.
If that doesn't work, try removing the muselsl version requirement (@==1.01
)
I recommend editing requirements_mac.txt and upgrading Pygatt. (I'm upgraded from 3.2.0 to 4.0.5 and I am able to stream successfully)
I followed the instructions, installed the packages via conda, ran the notebook mac-notebook.ipynb, but kept failing at step 1 with no headset connectivity, with error messages like NotConnectedError: No BGAPI compatible device detected
After poking around a little bit I was able to determine that the failure was coming from pygatt. The pygatt github page recommends the following to print debug info:
import pygatt
import logging
logging.basicConfig()
logging.getLogger('pygatt').setLevel(logging.DEBUG)
In my case, this revealed the errors:
DEBUG:pygatt.backends.bgapi.bgapi:Failed to open serial port
...
OSError: [Errno 16] Resource busy
Pygatt's issue page had a section for connectivity issues, ultimately it ends with a "Please upgrade to version 4". This worked for me.
Otherwise thanks a million for providing mac-specific instructions for working with these notebooks, they are tremendously helpful :)
This issue will host advanced instructions, common issues, and discussion related to setting up and running EEG notebooks on MAC computers.
Common Issues
The command was not found or was not executable: gatttool