I am new to MNE python - Errors while using raw.filter function

Dear MNE Community Members,
Greetings.
I am new to MNE python, I am working on an EEG dataset contains s9 channel with .CSV files.
I am using Google Colab.
I managed to plot the data; when I tried to use a filter I got the following message, Appreciate your help to resolve the problem.
Here is the code used for loading the data.


Some information about the channels

ch_names = [β€˜Fp1’, β€˜Fp2’, β€˜F3’, β€˜F4’, β€˜C3’, β€˜C4’, β€˜P3’, β€˜P4’, β€˜O1’,β€˜O2’,β€˜F7’, β€˜F8’, β€˜T7’,β€˜T8’,β€˜P7’,β€˜P8’,β€˜Fz’,β€˜Cz’, β€˜Pz’]

sfreq = 128 # Hz

info = mne.create_info(ch_names, sfreq,ch_types=β€˜misc’)

raw = mne.io.RawArray(npdata.T, info)

Output screen:
Creating RawArray with float64 data, n_channels=19, n_times=14304
Range : 0 … 14303 = 0.000 … 111.742 secs
Ready.

raw.plot() works fine.

Issues starts appearing from this point:
raw.filter(1,40,picks=[β€˜misc’])

Error message::
No data channels found. The highpass and lowpass values in the measurement info will not be updated.
Filtering raw data in 1 contiguous segment
Setting up band-pass filter from 1 - 40 Hz

FIR filter parameters

Designing a one-pass, zero-phase, non-causal bandpass filter:

  • Windowed time-domain design (firwin) method
  • Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
  • Lower passband edge: 1.00
  • Lower transition bandwidth: 1.00 Hz (-6 dB cutoff frequency: 0.50 Hz)
  • Upper passband edge: 40.00 Hz
  • Upper transition bandwidth: 10.00 Hz (-6 dB cutoff frequency: 45.00 Hz)
  • Filter length: 423 samples (3.305 sec)

TypeError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/IPython/core/formatters.py in call(self, obj)
336 method = get_real_method(obj, self.print_method)
337 if method is not None:
β†’ 338 return method()
339 return None
340 else:

2 frames
/usr/lib/python3.7/posixpath.py in basename(p)
144 def basename(p):
145 β€œβ€β€œReturns the final component of a pathname”""
β†’ 146 p = os.fspath(p)
147 sep = _get_sep(p)
148 i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType
<RawArray | 19 x 14304 (111.7 s), ~2.1 MB, data loaded>

Appreciate your help. Thank you very much.

info = mne.create_info(ch_names, sfreq,ch_types=β€˜misc’)
should be:
info = mne.create_info(ch_names, sfreq,ch_types=β€˜eeg’)

Alex

Thanks for the reply.
I tried that (misc to eeg), the raw. plots look different from before.
raw. filter command results in the following message.

Filtering raw data in 1 contiguous segment
Setting up band-pass filter from 1 - 40 Hz

FIR filter parameters

Designing a one-pass, zero-phase, non-causal bandpass filter:

  • Windowed time-domain design (firwin) method
  • Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
  • Lower passband edge: 1.00
  • Lower transition bandwidth: 1.00 Hz (-6 dB cutoff frequency: 0.50 Hz)
  • Upper passband edge: 40.00 Hz
  • Upper transition bandwidth: 10.00 Hz (-6 dB cutoff frequency: 45.00 Hz)
  • Filter length: 423 samples (3.305 sec)

TypeError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/IPython/core/formatters.py in call(self, obj)
336 method = get_real_method(obj, self.print_method)
337 if method is not None:
β†’ 338 return method()
339 return None
340 else:

2 frames
/usr/lib/python3.7/posixpath.py in basename(p)
144 def basename(p):
145 β€œβ€β€œReturns the final component of a pathname”""
β†’ 146 p = os.fspath(p)
147 sep = _get_sep(p)
148 i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType
<RawArray | 19 x 14304 (111.7 s), ~2.1 MB, data loaded>


Here is two plots when I use two types of ch_types…
plot 1–> info = mne.create_info(ch_names, sfreq,ch_types=β€˜misc’)
plot 2-> info = mne.create_info(ch_names, sfreq,ch_types=β€˜eeg’)

For raw.filter(0.5,40,picks=[β€˜eeg’]) , kindly see the resulting screen.
Filtering raw data in 1 contiguous segment
Setting up band-pass filter from 0.5 - 40 Hz

FIR filter parameters

Designing a one-pass, zero-phase, non-causal bandpass filter:

  • Windowed time-domain design (firwin) method
  • Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
  • Lower passband edge: 0.50
  • Lower transition bandwidth: 0.50 Hz (-6 dB cutoff frequency: 0.25 Hz)
  • Upper passband edge: 40.00 Hz
  • Upper transition bandwidth: 10.00 Hz (-6 dB cutoff frequency: 45.00 Hz)
  • Filter length: 845 samples (6.602 sec)

TypeError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/IPython/core/formatters.py in call(self, obj)
336 method = get_real_method(obj, self.print_method)
337 if method is not None:
β†’ 338 return method()
339 return None
340 else:

2 frames
/usr/lib/python3.7/posixpath.py in basename(p)
144 def basename(p):
145 β€œβ€β€œReturns the final component of a pathname”""
β†’ 146 p = os.fspath(p)
147 sep = _get_sep(p)
148 i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType
<RawArray | 19 x 14304 (111.7 s), ~2.1 MB, data loaded>

Many Thanks,

@kkmujeeb please share a full code snippet from reading the CSV to the plot and filter

Alex