Ah! The DC-offset explains why I got wavelet-form. Thanks a lot for looking it into again!
This time I plotted it for a longer period of time (in the following example for 20s), it looks almost the same now (red original, yellow resampled):
I just released version 1.04 of the EDF-resampler. This new version will preload the lowpass filters with
the first second of samples before the actual conversion starts. Now the artefact at the start is much shorter in time and much smaller in amplitude.
Great! Many thanks!
I tried the newest version of EDF-resampler. In the beginning the edge effect is not visible anymore, however afterwards, it is still there:
Would it be feasible to make the edge effects disapper from the whole recording?
Another question would be:
In 2 bio channels “BVP 0” and “BVP 1” (except positions with edge effects), the resampled data are almost the same. But in channel “Resp” the data is a bit different from the original (at peaks around 0.1mV). Since the signal varies around 0.5mV from peak to trough in the first segment (in the plot below), 0.1mV would be no small difference.
Would it also be possible to make the difference as smaller as possbile?
Hi @cbrnr , I would like to make sure, that I understood it correctly:
It should be possible to load the channels with different sampling rates separately in mne, correct?
Because I tried it with the function mne.io.read_raw_edf
with the argument include
or exclude
. Both with mne1.1 and mne1.3, it didn’t succeed… I got some errors, please see here.
I would have assumed that picking channels would return them with their native sampling frequency. If this is not the case, it is either a bug, not documented correctly, or not implemented. Since the docstring for the exclude
parameter states “Channel names to exclude. This can help when reading data with different sampling rates to avoid unnecessary resampling. A str is interpreted as a regular expression.”, I’d say it is a bug if this is not working as inteded. In this case, I’d recommend to open a new issue (this is separate from the issue related to block-wise resampling).
What you see there is caused by the fact that that part of the original trace contains frequency components outside of the Nyquist bandwidth. What you see in the original file is a perfectly rectangular signal change (probably caused by some digital manipulation) which can not really exist. Filters don’t like that and there’s no solution for that other than to ignore it.
I’ll investigate where the dc-offset comes from.
This is caused by the passband ripple of the lowpass filters in combination with the high dc-offset of the “Resp” channel. Passband ripple is specified as 0.01 dB (less than 0.1%) so the the difference is well within the specs.
However, I just released a newer version (1.05) that adds the option to set the passband ripple in the range 0.0001 to 0.01 dB. You can set it to 0.0001 in order to try to lower the offset.
Thanks for the reply!
I have opened an issue in github: mne.io.read_raw_edf cannot load data correctly with argument `include` or `exclude` · Issue #11486 · mne-tools/mne-python · GitHub
Many thanks! I will try it out.