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 = mne.io.read_raw_fif(myrawpath)
raw.info['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?

Kirill

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.

Cheers,
Richard

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).

2 Likes

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

It might be a little off topic, but how did you download/install ELEKTA Maxfilter for Matlab?
I tried following this preprocessing guide but with no luck

Best,

Mathias

I am not aware of a MATLAB implementation of MaxWell filter, in the post above, Elekta MaxFilter refers to the commercial software from the MEG manufacturer MEGIN (previously known as Elekta/Neuromag).

Mathieu

I have only used ELEKTA Maxfilter and MNE Python Maxfilter. I know nothing about Maxfilter in Matlab environment.