Support specifying start and stop time points for averaging in `evoked.plot_topomap()`

Open
#12,857 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
python

Research direction

Start by reading the evoked.plot_topomap() entry point and how its times and average arguments currently define topomap windows. Determine an API that supports explicit start and stop times without breaking arrays of time points, then verify that the requested interval produces the intended mean amplitude and that existing behavior remains supported.

Written by the indexing model from the issue text.

Description

ENH

The API for evoked.plot_topomap() is rather specific in that the times argument only accepts one or more time points, which are used to create the topomap(s). However, a common (the most common?) approach for analyzing ERP data is to use the mean amplitude within a given time window.

For example, if I wanted to plot the average amplitude from 185ms to 240ms, it would be ideal to directly specify this time range when creating the topomap. Currently, the API requires manually finding the midpoint (185 + (240 - 185) / 2 = 212.5) and passing it to times, and then passing the width (240 - 185 = 55) separately via the average argument, which feels a bit cumbersome.

Unfortunately, I don't have a good idea how to incorporate this use case into the current API (especially because times can already be an array of time points, but these do not specify time windows). I'd be interested in what you think about improving support for computing averages within time windows – or maybe this is already possible and I'm just missing something? Also, this issue might apply to more ERP-related functions, but this was the first one I found.

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

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.

More from mne-tools/mne-python

All issues in mne-tools/mne-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.