wrong meg channel

Hello everyone :slight_smile: I have a problem/question:

The system used to acquire the MEG data I’m working with had 275 MEG axial gradiometers, however, in the info data structure this is indicated as channel type ‘mag’. Is there a way to change all channel types from ‘mag’ to ‘grad’, preferably within the evoked data file?
I am working with:

  • MNE version: 0.23.4
  • operating system: Windows 10

Thank you!

Hello,

Raw, Epochs or Evoked all have a set_channel_types method.
e.g. mne.Evoked — MNE 1.0.0 documentation
It can be used by providing a mapping with the key being the channel names the value the new channel type.

Mathieu

Hi Mathieu!
Thanks for responding to me.
However, the documentation of the set_channel_types method doesn’t say it supports the channel types ‘grad’ and ‘mag’, so I am not sure what to do there…
Kind regards,
Janne

I guess the documentation could be updated. Could you open an issue on the GitHub issue tracker?
It does seems to work as intended:

import mne
import numpy as np


data = np.random.randint(0, 10, size=90).reshape((3, 30))
info = mne.create_info(['1', '2', '3'], 1000, ch_types=['mag', 'grad', 'grad'])
raw = mne.io.RawArray(data, info)
raw.set_channel_types({'1': 'grad', '2': 'mag', '3': 'mag'})

Before: chs: 1 Magnetometers, 2 Gradiometers
After: chs: 1 Gradiometers, 2 Magnetometers

I would think that we should assign the correct channel types from the start, automatically … what kind of data is that, @Janne?

@Janne - By the number of channels and having axial gradiometers - it appears that you have a CTF system. The axial gradiometers are treated a magnetometers in the MNE software. I am assuming this is because they have a more similar signal profile to mag than the planar gradiometers in Elekta/Megin. You do not need to convert these to grad - just use them as ‘mags’ in MNE. Below is from the CTF system at NIMH (271 out of 275 good channels) - it shows the gradiometers as ‘mags’. I think that there is another post in the MNE forums about this.

Out[9]: 
<Info | 16 non-empty values
 bads: []
 ch_names: SCLK01-177, BG1-1609, BG2-1609, BG3-1609, BP1-1609, BP2-1609, ...
 chs: 6 misc, 28 Reference Magnetometers, 271 Magnetometers, 2 EEG
 comps: 5 items (list)
 ctf_head_t: CTF/4D/KIT head -> head transform  
2 Likes

Here is the context for why axial gradiometers are considered ‘mags’:

1 Like

@agramfort Do you think we should issue an informative log message when this happens during reading CTF data? As we see here, it’s confusing, albeit being documented (?) behavior.

1 Like

Hi Mathieu,
This seems to work indeed.
Thank you!
Kind regards,
Janne

Hi Jeff,

Thank you for responding. It is indeed a CTF system.
Eventually, I changed the channel type to ‘grad’ because I had trouble when computing the adjacency matrix for cluster analysis. I got an error when the channel type was ‘mag’, so I changed the channels to ‘grad’, and then it worked.
Otherwise, just using them as ‘mag’ in MNE should work fine too.

Thanks again,
Kind regards,
Janne