error: Info does not support directly setting the key ‘gdf_events’.
MNE version: 1.1.0
operating system: Windows 10
code:
class BCICompetition4Set2A(object):
def __init__(self, filename, load_sensor_names=None, labels_filename=None):
assert load_sensor_names is None
self.__dict__.update(locals())
del self.self
def load(self):
cnt = self.extract_data()
events, artifact_trial_mask = self.extract_events(cnt)
cnt.info["events"] = events
cnt.info["artifact_trial_mask"] = artifact_trial_mask
return cnt
def extract_data(self):
raw_gdf = mne.io.read_raw_gdf(self.filename, stim_channel="auto")
raw_gdf.load_data()
data = raw_gdf.get_data()
for i_chan in range(data.shape[0]):
this_chan = data[i_chan]
data[i_chan] = np.where(
this_chan == np.min(this_chan), np.nan, this_chan
)
mask = np.isnan(data[i_chan])
chan_mean = np.nanmean(data[i_chan])
data[i_chan, mask] = chan_mean
gdf_events = mne.events_from_annotations(raw_gdf)
raw_gdf = mne.io.RawArray(data, raw_gdf.info, verbose="WARNING")
raw_gdf.info["gdf_events"] = gdf_events
return raw_gdf
run code ,error:
RuntimeError: Info does not support directly setting the key ‘gdf_events’. You can set info[‘temp’] to store temporary objects in an Info instance, but these will not survive an I/O round-trip.
I want to put multiple values in ‘info’(‘events’ and ‘artifact_trial_mask’), but can only use ‘temp’. What should I do?