how to filtering multi variable and multi-modal datas?

  • MNE version: 1.0.1
  • operating system: Windows 10

at cutoff
for cutoff in (0.1, 0.2):
raw_highpass = raw_.copy().filter(l_freq=cutoff, h_freq=None)
with mne.viz.use_browser_backend(‘matplotlib’):
fig = raw_highpass.plot(duration=60, proj=False,
n_channels=len(raw.ch_names), remove_dc=False)
fig.subplots_adjust(top=0.9)
fig.suptitle(‘High-pass filtered at {} Hz’.format(cutoff), size=‘xx-large’,
weight=‘bold’)

RuntimeError: By default, MNE does not load data into main memory to conserve resources. inst.filter requires raw data to be loaded. Use preload=True (or string) in the constructor or raw.load_data().

i used PSG sample

use:

raw.load_data()

Alex

that command just print raw file data details i know,

i wonder Error means

i loaded : raw = mne.io.read_raw_edf(f, stim_channel=‘Event marker’,
misc=[‘Temp rectal’]) → this way

error says filter requires raw data to be loaded : ??? i loaded!

Hello @PhD-GOAT, you have to run raw.load_data() as @agramfort suggested, or pass preload=True to the read command. By default, MNE doesn’t preload the data from disk when you read it. It only retrieves some metadata. But for filtering, you need to explicit load the data.

module ‘mne.io’ has no attribute ‘load_data’

→ i tried from mne.io import read_raw_edf, load_data

in io → init.py , there is no load about raw

It’s

raw = mne.io.read_raw_edf(f, stim_channel=‘Event marker’, misc=[‘Temp rectal’])
raw.load_data()

exactly!!

but, yesterday i tried that command and print error
maybe i typed wrong ?? i dont understand

Yes it was probably just a typo.

BTW, there is a typo in your code snippet, Richard. :slight_smile:
Unless .read_data() was renamed to .read_dara() recently :wink:

1 Like

Let me quickly make the pull request so my code snippet matches the MNE API :sweat_smile:

Edit: I’ve fixed the typo in the posting instead

1 Like