question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG/MAINT] Topomap `image_interp='None'` still interpolates

See original GitHub issue

In writing https://github.com/mne-tools/mne-python/pull/10571, having values that are not spatially continuous over a topomap made for real problems with the existing interpolation methods so I added a Voronoi option. The following code uses image_interp='None' but in my mind, this is still applying an interpolation. I was planning on adding the Voronoi option to image_interp but I thought maybe it should replace None. In the matplotlib documentation, the interpolations are demonstrated on images, which makes much more sense for None, but with points, I think this behavior is unexpected–for me, I just want an option to see the raw data. I added a new opinions-wanted tag because I think this is an especially good one to hear what other people think.

import os.path as op
import mne
import matplotlib.pyplot as plt

data_path = mne.datasets.sample.data_path()
evoked =mne.read_evokeds(op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif'))[0]
evoked.pick_types(eeg=True)
evoked.apply_proj()
fig, ax = plt.subplots()
mne.viz.plot_topomap(evoked.data.mean(axis=1), evoked.info, image_interp='None', axes=ax)   # still interpolates
Screen Shot 2022-04-28 at 11 33 00 AM

The Voronoi plot looks like this:

Screen Shot 2022-04-28 at 12 26 56 PM

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:29 (29 by maintainers)

github_iconTop GitHub Comments

2reactions
larsonercommented, May 9, 2022

So I tend to prefer option (4). Alternatively, we could implement the behavior of (4) with out existing image_interp parameter, which would be less breaking I guess.

+1 for (4) while keeping the name as (the slight misnomer) image_interp rather than rename to interpolation by deprecation

Another downside would be loss of control over matplotlibs imshow smoothing that we use. But the resulting API would be simple and clear.

If people really need it, there should be something like ax.images[0].set_interpolation(...) that they can do afterward, so I’m not too worried about this

1reaction
mmagnuskicommented, May 9, 2022

Why would anyone want to distinguish between data interpolation and image interpolation?

@cbrnr This is what we do now (kind of), but I agree it is not ideal. The reason for current state of afairs is rather technical, I think - we do cubic interpolation on a grid, but do not waste resources to make the grid super-fine-grained (although it can be controlled by res) if it can be linearily smoothed by matplotlib when displayed for a similar visual effect. I actually never used image_interp when plotting topomaps, and I guess many users did not, so maybe option 4 wouldn’t be so destructive as it sounds. So you can count me as +0.5 on option 4 as well. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Topographic Maps | U.S. Geological Survey - USGS.gov
The Historical Topographic Map Collection (HTMC) is the set of scanned images of USGS topographic quadrangle maps originally published as paper documents in ......
Read more >
Plotting topographic maps of evoked data - MNE-Python
Load evoked data and plot topomaps for selected time points using multiple ... Instead of using a still image we can plot magnetometer...
Read more >
USA Topo Maps - Overview
This map presents land cover and detailed topographic maps for the United States. The map includes the National Park Service (NPS) Natural Earth...
Read more >
How to Read a Topo Map - REI
How contour lines let you visualize your terrain; How map scales work; Other useful map details; Where to find topo maps. Also read...
Read more >
Topographic Quad Maps - Maine.gov
To start generating your USGS topo map, follow these steps: Click on "Imagery" at the top right. Click on the blue "Add" tab....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found