mne-tools / mne-tools/mne-python

AverageTFR.plot_topo color scale bug

Open
#11,247 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

MWE adapted from #10920

import numpy as np
import mne

data_path = mne.datasets.sample.data_path()
subjects_dir = data_path / 'subjects'
raw_fname = data_path / 'MEG' / 'sample' / 'sample_audvis_raw.fif'

# Read the raw data
raw = mne.io.read_raw_fif(raw_fname)
raw.info['bads'] = ['MEG 2443']  # bad MEG channel

# Set up the epoching
events = mne.find_events(raw)

# pick data channel types
raw.pick(['meg', 'eeg', 'eog'])

# create epochs, leave room for cutting out edge artifact
epochs = mne.Epochs(raw, events, event_id=dict(left_aud=1),
                    tmin=-0.5, tmax=0.5, baseline=(None, 0),
                    preload=True, proj=False,
                    reject=dict(grad=4000e-13, mag=4e-12,
                                eeg=1e-4, eog=150e-6))

# done with eog now
del raw
epochs.pick(['meg', 'eeg'])

# set average reference
epochs.set_eeg_reference('average', projection=True)

# focus on alpha and beta oscillations
freqs = np.logspace(*np.log10([8, 35]), num=6)

# select subset of trials for speed
epochs = epochs[:10]

# time-frequency decomposition
average_tfr = mne.time_frequency.tfr_morlet(
    epochs, freqs=freqs, n_cycles=freqs / 2, return_itc=False,
    average=True)

average_tfr.plot_topo()

plotting average_tfr.plot_topo(picks=slice(0, 2)) or slice(0, 5) or even slice(0, 40) yields (partial) topo plots where at least some of the sensors have visible activity. I'm assuming some sort of bad color normalization (across sensors) is the cause, but that's a wild guess.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided MWE and calling AverageTFR.plot_topo() with the listed picks slices. Inspect the plot_topo color normalization and related plotting path; done means the full plot and sliced plots consistently show the expected sensor activity without the reported partial topo behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.