Data mismatch from MaxFilter and mne.preprocessing.maxwell_filter

Hi, all

I found that results of ELEKTA Maxfilter and MNE Python Maxfilter are different, even exactly the same input parameters are used. Could somebody comment on that?

I have Linux Centos 7 x86_64-7.1.1 with Maxfilter 2.2.10 and Python 3.7.10 with MNE 0.22.10.

Command line options for Maxfilter:

/neuro/bin/util/maxfilter -f myrawpath -o myssspath -ctc /neuro/databases/ctc/ct_sparse.fif -cal /neuro/databases/sss/sss_cal.dat -autobad off -bad 2633 0442 2642 0923 0622 2612 1623 1412 1413 2212 -format float -v.

And command line options for MNE-Python:

raw =['bads'] = ['MEG2633', 'MEG0442' ,'MEG2642' ,'MEG0923' ,'MEG0622', 'MEG2612', 'MEG1623', 'MEG1412', 'MEG1413', 'MEG2212']
raw_sss = mne.preprocessing.maxwell_filter(raw,
   calibration = /neuro/databases/sss/sss_cal.dat,
   cross_talk =  /neuro/databases/ctc/ct_sparse.fif)

then I filter both signals with parameters:

raw.notch_filter(np.arange(50, 201, 50), filter_length='10s', phase='zero')
raw.filter(None, 110., fir_design='firwin')

I get different results for MaxFilter and in MNE-Python (see the fig below: left - MaxFilter, right - MNE-Python)

From the first glance the parameters I give to MaxFilter and MNE-Python are the same. What could be the reason for differences?


Hello @Kirill and welcome to the forum!

MaxFilter is a commercial product and MNE-Python’s maxwell_filter tries to do the same thing, but is not guaranteed to yield the exact same results – the implementation is simply different. So I would say this is very much to be expected.

cc @larsoner, who wrote the maxwell_filter function and related code in MNE-Python.


Some of the default values for MaxFilter are different from MNE-Python. For example, the origin is fit to dig points in MNE-Python, but MaxFilter defaults to 0,0,40. Setting all parameters to be equivalent in the two calls, you should end up with very similar results (unless you are using movement compensation, where MNE-Python has time-varying regularization and MaxFilter does not).

1 Like

Your advice helped make my data very similar, but still different. Now I understand that it is impossible to make them the same. Thanks to Richard and Eric for answers.

1 Like