The data is already loaded from disk issue from mne

50 Views Asked by At

i am following this tutorial M/EEG analysis with MNE Python

and i have a little errors in this fragment : 01:35:57 Working with BIDS data

i followed all the steps before and also implemented code :

import matplotlib.pyplot as plt
import pathlib
import matplotlib
import mne
import mne_bids
matplotlib.use('Qt5Agg')
directory ='C:/Users/User/mne_data/MNE-sample-data/MEG\sample/sample_audvis_raw.fif'
raw =mne.io.read_raw(directory)
#raw.plot()
#plt.show()
events =mne.find_events(raw)
#print(events)
event_id ={
    "Auditory/Left":1,
    "Auditory/Right":2,
    "Visual/Left":3,
    "Visual/Right":4,
    "Smiley":5,
    "Button":32
}
raw.info['line_freq']=60
raw.load_data()
out_path =pathlib.Path("out_data/sample_bids")
bids_path =mne_bids.BIDSPath(subject='01',session='01',task='audiovisual',run='01',root=out_path)
mne_bids.write_raw_bids(raw,bids_path=bids_path,events_data=events,event_id=event_id,overwrite=True)

but when i am running this code, i am getting issue :

ValueError: The data is already loaded from disk and may be altered. See warning for "allow_preload".

i can't understand reason of this error, how can i fix it?please helo me

0

There are 0 best solutions below