NeuroTechX / EEG-ExPy

EEG Experiments in Python
https://neurotechx.github.io/EEG-ExPy/
BSD 3-Clause "New" or "Revised" License
418 stars 124 forks source link

N170 Load and Visualize Data #205

Closed Liam-Noah closed 1 year ago

Liam-Noah commented 1 year ago

📝 Provide a description of requested docs changes

https://neurotechx.github.io/eeg-notebooks/auto_examples/visual_n170/01r__n170_viz.html Hello, Could you explain how eegnb_data_path and n170_data_path variable are and how to use them ? I set n170_data_path to be n170_data_path = "C:/Users/.../.eegnb/data/visual_n170/local/muse2/subject0000/session000/recording_2022-09-12-15.40.21.csv" but apparently I have to change eegnb_data_path aswell ?

the examples work well on their own

update : I changed a few things subject = 0 session = 0 raw = load_data(subject,session, experiment='visual_n170', site='local', device_name='muse2', data_dir = eegnb_data_path)

update: it's a problem with the csv, sometimes it has 7 columns and it expects 6 I get this error :

ParserError: Error tokenizing data. C error: Expected 6 fields in line 14, saw 7

update4:

I added to the csv another column in the first line

now I get another error:

TypeError: can't multiply sequence by non-int of type 'float'

update5: so aparently if I just add the column to the first line of the csv without changing anything else, this solves the problem still, in jupyter notebook you have just images of the mne plot, it's not interactive

JohnGriffiths commented 1 year ago

Hi Vladimir. Can you screenshot the first 30 lines or so of the csv file ? Is it missing the final column in the first few rows?

Liam-Noah commented 1 year ago

Hi Vladimir. Can you screenshot the first 30 lines or so of the csv file ? Is it missing the final column in the first few rows?

Yes, that's exactly what's happening here

Screenshot 2022-09-15 104104

JohnGriffiths commented 1 year ago

Ok. This is a known bug that occurs sometimes with muselsl streaming that has to do with asynchronous recording process initialization, and that we haven't managed to get a robust fix to yet unfortunately.

Sorry this has been a problem.

The data you have should be usable, the file just needs repairing. There is a function in the library for this:

https://github.com/NeuroTechX/eeg-notebooks/blob/a22501228677df0f968c49a0a699207380b1bd50/eegnb/analysis/utils.py#L530

usage ftom a python interpreter:

from eegnb analysis.utils import fix_musemissinglines

fpath = " " # path to the .csv file
fix_musemissinglines(fpath)

Which will create a new file with '_fml.csv' as suffix in the same folder.

Moving forward, you have two options:

  1. Continue as you have been, and applying this fix, to recorded files

  2. Switch streaming options

I highly recommend 2. The brainflow streaming options do not have this issue. You would give device option muse2_bfn ( bfn stands for BrainFlow with Native bluetooth hardware of your system, as opposed to brainflow with a BLED dongle which is '_bfb' ). The only reason why this isn't the only option listed is there are some unsolved brainflow issues with the newest windows 11 distributions. But you should try and see if this works on your comp.

What OS are you on?

Liam-Noah commented 1 year ago

Hi again, I'm on windows 10. I'll give brainflow a try since there are less bugs. Thanks for the tips !

Do you real time analysis with jupyter notebook aswell? Like a neurofeedback window with live parameters, to see how well you do on getting focused or calm .

oreHGA commented 1 year ago

Hi @Liam-Noah , eeg-notebooks doesn't currently support realtime analysis but here are a couple links that could help

Some headsets like Neurosity has an api that can give you predictions every second of focus/calm