Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magnetometer positions look odd in PSD plot #7837

Closed
hoechenberger opened this issue May 27, 2020 · 7 comments · Fixed by #7878
Closed

Magnetometer positions look odd in PSD plot #7837

hoechenberger opened this issue May 27, 2020 · 7 comments · Fixed by #7878

Comments

@hoechenberger
Copy link
Member

hoechenberger commented May 27, 2020

Steps to reproduce

Let's first visualize the magnetometer channel positions via Raw.plot_sensors():

import mne
from mne.datasets import sample


data_path = sample.data_path()
fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(fname)
raw.plot_sensors(ch_type='mag')

This produces:
sensors

Looking good. Now let's plot PSDs of the data.

raw.plot_psd()

Result cropped so it only shows the sensor positions (top to bottom: mag, grad, eeg):
Figure_1 copy

The magnetometer sensor layout looks incorrect, and doesn't match the one produced by plot_sensors(). Am I missing something here?

cc @agramfort

@agramfort
Copy link
Member

agramfort commented May 27, 2020 via email

@larsoner
Copy link
Member

Agreed it's a bug, no idea the cause. Someone will have to dig into the viz code to figure out why this is happening...

@agramfort
Copy link
Member

this allows to clearly show the bug:

import mne
import os

sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
                                    'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, preload=True)
raw.plot_psd(picks=['grad'])
raw.plot_psd(picks=['mag'])
raw.plot_psd(picks=['meg'])

@agramfort
Copy link
Member

agramfort commented Jun 8, 2020

and the bad news is that the bug is in the 0.20 stable release :( :(

@larsoner
Copy link
Member

larsoner commented Jun 8, 2020

I'll git bisect and see how hard it is to fix

@agramfort
Copy link
Member

thanks

@larsoner
Copy link
Member

larsoner commented Jun 8, 2020

Looks like it was 9e78506 / #7486, cc @drammock -- I'll see if I can figure out what the problem is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants