mags/grads in CTF data

  • MNE version: e.g. 1.8.0
  • operating system: e.g. macOS 15

When reading CTF data MNE recognizes channels as magnetometers with unit T, while they should be gradiometers with unit T/m.
Also, it recognizes the same channels as both mags and grads when I use mne.pick_types(info, meg=‘mag’) (see example below).

Could you explain where MNE gets the info about a channel, whether it is mag or grad?
Is there a way to change the sensor type and unit?

In my example, I use data set ds000246 from openneuro.

import mne

# Load MEG CTF data
raw = mne.io.read_raw_ctf(data, preload=True)

# Get channel information
info = raw.info

# Check if a channel is mag or grad
mags = mne.pick_types(info, meg='mag')
grads = mne.pick_types(info, meg='grad')

print(f'Magnetometer channels: {len(mags)}')
print(f'Gradiometer channels: {len(grads)}')

#print gradiometer channels with names and unit:
mag_channels = [[info['ch_names'][ch], info['chs'][ch]['unit'], info['chs'][ch]['kind']] for ch in mags]
grad_channels = [[info['ch_names'][ch], info['chs'][ch]['unit'], info['chs'][ch]['kind']] for ch in grads]
print('MAGS', mag_channels)
print('GRADS', grad_channels)

As a results I get this:

Magnetometer channels: 300
Gradiometer channels: 26

MAGS [['BG1-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['BG2-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['BG3-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ..... ['R12-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['R13-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['R22-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)] ..... ['MLC12-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)], ['MLC13-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)], ['MLC14-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)], ['MLC15-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)], ['MLC16-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)], ['MLC17-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)], ['MLC21-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)], ['MLC22-4408', 112 (FIFF_UNIT_T), 1 (FIFFV_MEG_CH)]...]

GRADS [['BG1-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['BG2-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['BG3-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ..... ['R12-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['R13-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)], ['R22-4408', 112 (FIFF_UNIT_T), 301 (FIFFV_REF_MEG_CH)]]

As you see, the same channels are recognized as mag and grad, but among mags there are additional 274.

Well spotted! I also have the same issue with my CTF data.

This bug seems to date back to 2019 (see
(1) and (2)) and has not been fixed.

I’m not sure if this will cause problems later in your pipeline. In the past, problems with computing the adjacency matrix for cluster analysis have been reported.

You can manually change the channels from mag to grad. Here’s a helpful suggestion: wrong meg channel - #4 by mscheltienne

It might be worth filing an issue on GitHub, so this gets fixed. From a quick look, I did not find any issue filed regarding this topic.

1 Like

Hello! Thank you for a very detailed response!

Yes, manually changing channel types from the link you gave works. Example:

raw2.set_channel_types({'MLC12-2910': 'grad', ...})

(this will change both the type and unit of the channel).

And I will open an issue on Git, as you suggested. I also searched for this topic there and didn’t find anything.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.