Channel order in combined MEG+EEG files, fwd operators

MNE version: e.g. 1.9.0, python: 3.12.6, OS: Windows 11

Hi,

we have been using MNE-python for source reconstruction of combined MEG+EEG data. Testing the quality with simulations, we noted that some results seemed rather odd, some single simulated sources move to other locations in the brain after fwd-inv-modeling, and correlations between time series before and after fwd-inv-modeling overall tended to be low.

Inspecting the forward operators, we then noticed that there may be a mismatch in the location of EEG channels by the MNE-python code.

Case 1: EEG channels are put after MEG channels in MNE-python:
This is what plotting the fwd[‘sol’][‘data’] implies and also reflected in fwd[‘sol’][‘row_names’], although in fwd[‘info’][‘ch_names’], EEG channels are first, as in the raw data.
This, we think, can be explained by the sensor type order being de-facto hard-coded through the variable:
_FWD_ORDER = dict(meg=“MEG”, eeg=“EEG”)
in mne-python code mne\forward\forward.py, as channels are then read out in exact this order.
We are not fully sure yet if and how this affects the inverse operators; as far as I can see, the code for making inverse operators reads only fwd[‘info’][‘ch_names’], not fwd[‘sol’][‘row_names’], but we haven’t figured out if this ch order actually influences computations.

Case 2: We got some fwd op files where the EEG channels end up in positions 242-305 in the fwd op, which is also reflected in fwd[‘sol’][‘row_names’]. We don’t have any explanation for this yet.

For comparison, we also created fwd and inverse operators for one subject with MNE-C: Here, the EEG channels are also put at the end, but this is also reflected in fwd[‘info’][‘ch_names’], and when we use these operators for source reconstruction (in MNE-python, the simulation results for this subject improve dramatically.

Has this been observed before? Is there a simple way to make sure that the channel order is handled correctly/consistently throughout all steps in MNE-python?


Hello everyone,

To continue this topic. We have been investigating this issue in the lab and found that forward operator is not an issue (at least in our case) but NCM/inverse operator use the incorrect channel order. Probably because when the solution is made for MEG/EEG separately and forces to have EEG channels at the end but the operator info is derived from the data info directly where EEG might come first (in our case at least).
therefore, we came to manual reordering of channels where EEG sensors are put after MEG in the data used to compute NCM/inverse operators as temporary solution.

Hi,

I think the best would be if you can use sample subject in MNE-Python and can try to replicate the same issue; it has data with MEG and EEG together. Then you can compare both results. Let us know your findings.

HTH,
Dip

1 Like

Hi,

For the sample data, the channels end up in the correct order - but that was absolutely expected.

The important difference between the sample data and our data is that the sample data was recorded with a Vectorview system and has MEG channels first in the raw file, whereas ours was recorded with Triux and has the EEG channels first in raw file.

So if MNE-python always automatically puts MEG channels first for the fwd operator, this doesn’t create a problem for the sample data, as that has the same order in the raw file. But for our data, it seems to be a problem.