OHBA-analysis / osl

OHBA Software Library - MEG/EEG Analysis Tools
https://osl.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
38 stars 8 forks source link

problem of lemon_dataset.py #295

Open ScarletVV opened 3 months ago

ScarletVV commented 3 months ago

When I ran this code, it output: sub-032333 : ** sub-032333 : PROCESSING FAILED! sub-032333 : ** sub-032333 : import_data : <function import_data at 0x7fd210b71900> sub-032333 : <class 'FileNotFoundError'> sub-032333 : [Errno 2] No such file or directory: '/home/uais1/Echo/OSL/DataPrepare/dataset/lemon/raw/sub-032333/RSEEG/sub-010041.vmrk' sub-032333 : None

How can I fix this?

cgohil8 commented 3 months ago

The problem is it can't find this file:

/home/uais1/Echo/OSL/DataPrepare/dataset/lemon/raw/sub-032333/RSEEG/sub-010041.vmrk

Seems like there's a mismatch between the filename and subject directory. It's trying to find the file sub-010041.vmrk in the directory for sub-032333.

ScarletVV commented 3 months ago

Yes it is, but my question is why the program wants to find the sub-010041.vmrk in the directory for sub-032333 ? I just download the data from https://fcon_1000.projects.nitrc.org/indi/retro/MPI_LEMON/downloads/download_EEG.html and use one of them(sub-032333) to test the code and 124 line of code deleted

subjects = subjects[:2]

There is no subject named sub-010041 here, and no obvious reading of the .vmrk file code snippet in the code.

cgohil8 commented 3 months ago

Where did you get lemon_dataset.py from? Can you send the contents of the script or a link.

ScarletVV commented 3 months ago

It should call 1_preprocess.py in osl/examples/lemon. https://github.com/OHBA-analysis/osl/blob/main/examples/lemon/1_preprocess.py

ScarletVV commented 3 months ago

This is the result of Jupyter Notebook running https://github.com/ScarletVV/lemon_process.git.

cgohil8 commented 3 months ago

What version of MNE are you using?

ScarletVV commented 3 months ago

MNE 1.3.1

cgohil8 commented 3 months ago

Do get the same error if you do:

import mne

raw = mne.io.read_raw_brainvision("/home/uais1/Echo/OSL/DataPrepare/dataset/lemon/raw/sub-032333/RSEEG/sub-032333.vhdr")
ScarletVV commented 3 months ago

yes

cgohil8 commented 3 months ago

ah, it's an error in MNE then. You can try upgrade MNE:

conda activate osl
pip install --upgrade mne

Although OSL hasn't been tested against versions above MNE 1.3.1, so you might run into new bugs. If you update MNE does the following work:

import mne

raw = mne.io.read_raw_brainvision("/home/uais1/Echo/OSL/DataPrepare/dataset/lemon/raw/sub-032333/RSEEG/sub-032333.vhdr")
ScarletVV commented 3 months ago

Same error after upgrading MNE. Can I solve this problem if I install a lower version of MNE?

ScarletVV commented 3 months ago

Thank you for your patient guidance and answers. I will try similar work directly on MNE.

cgohil8 commented 3 months ago

It's unlikely a lower version would fix this, but you can try.

You might be able to load it if you change the directory structure of the data. What happens if you create a new directory and copy only the .vhdr file into it. E.g. you can try something like:

mkdir ~/test
cp /home/uais1/Echo/OSL/DataPrepare/dataset/lemon/raw/sub-032333/RSEEG/sub-032333.vhdr ~/test
python
>> import mne
>> raw = mne.io.read_raw_brainvision("~/test/sub-032333.vhdr")

What happens then?

ScarletVV commented 3 months ago

Still same error...

cgohil8 commented 3 months ago

Can you try again downloading the data from here instead: https://ftp.gwdg.de/pub/misc/MPI-Leipzig_Mind-Brain-Body-LEMON/

ScarletVV commented 3 months ago

I try the data from your link then the mismatch error gone, but a new error :

sub-010005 : ** sub-010005 : PROCESSING FAILED! sub-010005 : ** sub-010005 : set_eeg_reference : functools.partial(<function run_mne_anonymous at 0x7fda3b84f9a0>, method='set_eeg_reference') sub-010005 : <class 'OSError'> sub-010005 : could not get source code sub-010005 : None Computation complete OSL osl_logger: handler 'console' level set to 'INFO' logging to file: /home/uais1/Echo/OSL/DataPrepare/dataset/lemon/test_preproc/logs/osl_batch.log Processed 0/1 files successfully

/home/uais1/Echo/osl/osl/preprocessing/mne_wrappers.py:67: RuntimeWarning: No bad channels to interpolate. Doing nothing... getattr(dataset[target], method)(**userargs) File "/home/uais1/Echo/osl/osl/preprocessing/batch.py", line 791, in run_proc_chain dataset = append_preproc_info(dataset, config, extra_funcs) File "/home/uais1/Echo/osl/osl/preprocessing/batch.py", line 367, in append_preproc_info preproc_info += f"%% extra_funcs start %% \n{inspect.getsource(func)}\n%% extra_funcs end %%" File "/home/uais1/anaconda3/envs/echo/lib/python3.10/inspect.py", line 1139, in getsource lines, lnum = getsourcelines(object) File "/home/uais1/anaconda3/envs/echo/lib/python3.10/inspect.py", line 1121, in getsourcelines lines, lnum = findsource(object) File "/home/uais1/anaconda3/envs/echo/lib/python3.10/inspect.py", line 958, in findsource raise OSError('could not get source code')

cgohil8 commented 3 months ago

What version of MNE are you using?

ScarletVV commented 3 months ago

1.7.0 then down to 1.3.1 still same error.

cgohil8 commented 3 months ago

Can you: