jump artifacts after filtering

Hi all,

At the moment I am working on a project in which I am comparing a semi-automatic preprocessing procedure in Matlab (using EEGlab and Fieldtrip toolboxes) to preprocessing in python using MNE (github.com/dvanmoorselaar/eeg_analysis<http://github.com/dvanmoorselaar/eeg_analysis>; still in development). I am able to exactly replicate the results from the Matlab pipeline, potentially allowing us to move all our eeg analyses to mne/python.
There is one problem however. While comparing the output in Matlab to that in python per preprocessing step I noticed some weird jump artifacts after applying a 0.5 high pass filter to the data:

session.filter(l_freq = 0.5, h_freq = None, filter_length = 3073, l_trans_bandwidth = 0.15)

As visualized below (Matlab in red, Python in green), after referencing the data are perfectly aligned (top figures). However, after applying a 0.5 high pass filter with the settings specified above (default Matlab settings), the data now all of a sudden contain jump artifacts. These artifacts are present at random intervals throughout the whole time series and in all channels. At first I thought this might have something to do with the chosen filter length (MNE give a warning that filter length should be increased), however when I increased the filter length three times these artifacts were still present (bottom right) in the data, although less frequent and at different time points).

[cid:05AE8DCA-D1A5-4AB4-BA6D-72A3B97E939D]
Also, I noticed that similar jump artifacts were present when applying a 0.5 low pass filter instead of a high pass filter, potentially indicating that something is off in the numpy fft convolution. At first sight there appeared nothing wrong with the power spectra of these filters.

Is this a known problem or am I doing completely incorrect?

Best,

Dirk van Moorselaar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151111/224fc92a/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filter_artifact.png
Type: image/png
Size: 67423 bytes
Desc: filter_artifact.png
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151111/224fc92a/attachment-0001.png

Which version are you running? There was a bug some months ago that
produced some jump artifacts, but it has been fixed in 0.10 (latest
release) and master.

Eric

Hi all,

At the moment I am working on a project in which I am comparing a
semi-automatic preprocessing procedure in Matlab (using EEGlab and
Fieldtrip toolboxes) to preprocessing in python using MNE (
github.com/dvanmoorselaar/eeg_analysis; still in development). I am able
to exactly replicate the results from the Matlab pipeline, potentially
allowing us to move all our eeg analyses to mne/python.
There is one problem however. While comparing the output in Matlab to that
in python per preprocessing step I noticed some weird jump artifacts after
applying a 0.5 high pass filter to the data:

session.filter(l_freq = 0.5, h_freq = None, filter_length = 3073,
l_trans_bandwidth = 0.15)

As visualized below (Matlab in red, Python in green), after referencing
the data are perfectly aligned (top figures). However, after applying a 0.5
high pass filter with the settings specified above (default Matlab
settings), the data now all of a sudden contain jump artifacts. These
artifacts are present at random intervals throughout the whole time series
and in all channels. At first I thought this might have something to do
with the chosen filter length (MNE give a warning that filter length should
be increased), however when I increased the filter length three times these
artifacts were still present (bottom right) in the data, although less
frequent and at different time points).

Also, I noticed that similar jump artifacts were present when applying a
0.5 low pass filter instead of a high pass filter, potentially indicating
that something is off in the numpy fft convolution. At first sight there
appeared nothing wrong with the power spectra of these filters.

Is this a known problem or am I doing completely incorrect?

Best,

Dirk van Moorselaar

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151111/a3099524/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filter_artifact.png
Type: image/png
Size: 67423 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151111/a3099524/attachment-0001.png

Thank you for the quick response. I was running version 0.9. I have updated now to version 0.10 and the jump artifacts are indeed no longer present.
There appears to be a offset shift though between matlab and mne filter (Matlab being consistently more negative), but I will look into this.
Thank you very much.

Best,

Dirk

General note,

if someone has the time and motivation to track down the subtle differences
in parametrisation of matlab VS scipy/mne filters I will pay that person a
huge beer next time we meet :slight_smile:
There is definitely something to be understood and improved in that corner.

Cheers,
Denis