Reputation: 1
I need to use mne python for my master degree project, but i'm new in python programming. So i'm trying to open a single EEG edf file, i have tried several codes and none of them worked. The last code i tried:
import mne
from google.colab import drive
drive.mount ('/gdrive')
cd /gdrive/drive/MyDrive/EDFfiles
fname = 'chb01_01.edf'
raw = mne.io.read_raw_edf(fname, preload=True)
FileNotFoundError Traceback (most recent call last) in () ----> 1 raw = mne.io.read_raw_edf(fname, preload=True)
4 frames /usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in read_raw_edf(input_fname, eog, misc, stim_channel, exclude, infer_types, preload, verbose) 1331 return RawEDF(input_fname=input_fname, eog=eog, misc=misc, 1332 stim_channel=stim_channel, exclude=exclude, -> 1333 infer_types=infer_types, preload=preload, verbose=verbose) 1334 1335
in init(self, input_fname, eog, misc, stim_channel, exclude, infer_types, preload, verbose)
/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in init(self, input_fname, eog, misc, stim_channel, exclude, infer_types, preload, verbose) 132 info, edf_info, orig_units = _get_info(input_fname, stim_channel, eog, 133 misc, exclude, infer_types, --> 134 preload) 135 logger.info('Creating raw.info structure...') 136
/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in _get_info(fname, stim_channel, eog, misc, exclude, infer_types, preload)
374 misc = misc if misc is not None else []
375
--> 376 edf_info, orig_units = _read_header(fname, exclude, infer_types)
377
378 # XXX: tal_ch_names
to pass to _check_stim_channel
should be computed
/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in _read_header(fname, exclude, infer_types) 361 logger.info('%s file detected' % ext.upper()) 362 if ext in ('bdf', 'edf'): --> 363 return _read_edf_header(fname, exclude, infer_types) 364 elif ext == 'gdf': 365 return _read_gdf_header(fname, exclude), None
/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in _read_edf_header(fname, exclude, infer_types) 578 edf_info = {'events': []} 579 --> 580 with open(fname, 'rb') as fid: 581 582 fid.read(8) # version (unused here)
FileNotFoundError: [Errno 2] No such file or directory: '/content/chb01_01.edf'
Upvotes: 0
Views: 1688
Reputation: 13
To open a edf
eeg
file using Python,
import mne
raw =mne.read_raw_edf('')
place the path to your edf
file in singlequotes
.
This will read your entire edf
. also,
raw.info
will give you the entire details of your file.
Upvotes: 0
Reputation: 149
just a suggestion: Firstly try to insert 'chb01_01.edf' in python working directory. Python will find the file or c:\temp_edf\chb01_01.edf. It is easier to find. best
Upvotes: 0