I have read an edf file with mne, which contains also 3 bio channels. The plots of the bio channels have abnormal patterns. However, these abnormalties disappeared when I read this edf file and plotted the bio channels in eeglab as well as in edfbrowser. Example plots of one bio channel:
mne plot:
Since the plots of mne seem “more continuous”, while the plots of both eeglab and edf-browser are step plots, I looked into the data in mne and in eeglab. The data are indeed also different though being read from the same edf file.
Data read in mne. raw.get_data()[0,:10]:
This EDF file contains signals with different sampling frequencies. The highest one is 2048Hz (EMG), whereas the respiration signal was sampled at 32Hz. MNE can only handle channels with a common sampling frequency, so it resamples all channels to 2048Hz in this case. It seems like there are some heavy filter artifacts on those resampled signals, which I cannot really explain without digging into the code.
Can you please report this as an issue in our GitHub repo? This is almost definitely a bug and should be fixed.
Thanks @Teuniz! I think MNE should also implement proper resampling of the entire signal as opposed to the chunk-wise resampling that we’re currently doing.
Or, even better, drop the requirement that all signals need to have equal samplerates.
I guess that, in cases with files with different samplerates, would also avoid unnecessary memory use and cpu cycles.
That’s not feasible anytime soon. MNE is built around data being available in a rectangular array. You can already process data with different sampling rates separately (e.g. load and process EMG with a high sampling frequency, then load and process EEG with a lower frequency separately), but if your analysis involves analyzing these signals in combination, you will have to resample at some point. So in the short term, proper resampling (maybe even with a selectable new sampling frequency) would be a nice addition.
It looks like edf-resampler is either not on your PATH and/or not executable. If the binary is located in your current working directory (check with ls), then try running it with ./edf-resampler -i test.edf -s 2048. If it still does not work, make sure that the executable bit is set (e.g. chmod +x edf-resampler) and then try again.
It’s exactly that. You need to put “./” directly in front of the command when you are in the same directory as the executable (or specify the full path). In case you like the tool and want to keep it permanently,
copy the executable to /home/username/bin That way, it will be in the PATH variable and you don’t need to specify the full path anymore.
B.t.w, I just released a new version (1.03) that uses a slightly better parameter for the resampling
algorithm because I noticed that when you upsample from 32 Hz to 2048 Hz (which is quiet extreme)
there’s some aliasing noise visible. So, I encourage you to pull again from Gitlab and recompile.
Regarding the “stairstep” plotting of the waveform in EDFbrowser, this happens when there are less samples than horizontal pixels in the waveform window.
If you want you can switch to linear interpolation which will avoid the stairstep effect.
The setting is in Settings → Options → Other → Use linear interpolation for plotting.
Unfortunately I did not suceed to load the data. The result is that,
eeg_raw only excluded one bio channel ‘Resp’.
emg_raw had no channel.
bio_raw had only 1 channel ‘Resp’…
Then I tried upgraded mne to 1.3, the result is that,
eeg_raw only excluded one bio channel ‘Resp’.
the following 2 lines did not work and I got TypeError: read_raw_edf() got an unexpected keyword argument 'include'. I looked into the function and found that include was not implemented in the function mne.io.read_raw_edf. According to the documentation it should be there…