mne-python: raw.add_channels 'buffer_size_sec' error

I’m trying to add a stim channel (a clean combination of multiple already existing stim channels) to a raw object:

# read raw
raw = read_raw_edf(fname, preload=True)

# clean stim
raw_stim = raw.pick_channels(chs_stim, copy=True)
data = clean_stim(raw_stim._data)

# append data
info = create_info(ch_names=['stim_clean'], sfreq=raw.info['sfreq'], ch_types=['stim'])
raw_stim = RawArray(data, info=info, first_samp=raw._first_samps[0])
raw.add_channels([raw_stim])

But I get the following error:

RuntimeError: Don't know how to merge 'buffer_size_sec'. Make sure values are compatible.

What shall I do?

cc @choldgraf @Eric89GXL

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 28 (28 by maintainers)

Most upvoted comments

It works with

        info['buffer_size_sec'] = raw.info['buffer_size_sec']
        info['filename'] = raw.info['filename']

I’m keeping the issue opened. I think we should have a less hacky way. WDYT?

I would expect to be able to do Raw.add_channels(data=np.array, ch_type=['stim', 'misc'], ch_names=['foo', 'bar'])