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.

Regression in "How to plot topomaps the way EEGLAB does" example - montage.get_positions() returns different positions than the channel positons in evoked object.

See original GitHub issue

Hi, I just noticed that the How to plot topomaps the way EEGLAB does example no longer shows correct EEGLAB-like channel layout: the two layouts are the same on the current development and stable versions (0.23), which is incorrect. On version 0.22 these layouts are different (and correct):

The sphere parameters used in the example are not the same as before and this seems due to a change in how channel positions are obtained. Previously they were dug out from .info['chs'] dictionary, now montage.get_positions() is used. However these two are not exchangable because the applied montage is in head coordinates, while the positions returned by .get_positions() show ‘unknown’ coord_frame. In the same example doing:

pos_mntg = biosemi_montage.get_positions()['ch_pos']['Oz']
ch_idx = fake_evoked.ch_names.index('Oz')
pos_evkd = fake_evoked.info['chs'][ch_idx]['loc'][:3]

print([f'{v:0.5f}' for v in pos_mntg])
print([f'{v:0.5f}' for v in pos_evkd])

gives different positions:

['0.00000', '-0.09494', '-0.00332']
['0.00000', '-0.09494', '0.03683']

I’m not sure what the best solution should be - is the intent of montage.get_positions() is to give channel positions in unknown coord frame? If so, the example should be reverted to use the old and ugly .info['chs'][idx]['loc'][:3] way of obtaining channel positions.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alexrockhillcommented, Aug 4, 2021

Yep, that fixed it. Making a PR.

0reactions
mmagnuskicommented, Aug 4, 2021

@alexrockhill That makes sense (your previous post about changing default to head) as MNE (as far as I know) defines head coordinates with respect to fiducial positions (z = 0), while the biosemi positions are likely in a coordinate system where Oz is at z=0 (which is exactly what the example tries to do - move the sphere origin a bit higher to be at the z level of Oz channel).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to plot topomaps the way EEGLAB does - MNE-Python
First we will create a simple evoked object with a single timepoint using biosemi 10-20 channel layout. biosemi_montage = mne.channels ...
Read more >
[Eeglablist] How to plot cluster ERP topo maps at specific ...
Dear James, The topoplot help says: >> topoplot(datavector, EEG.chanlocs); % plot a map using an EEG chanlocs structure This means that if ...
Read more >
d. Advanced plots - EEGLAB Wiki
m function is a powerful function that allows plotting time-frequency decompositions across all channels. % Compute a time-frequency decomposition for every ...
Read more >
EEGLAB Tutorial - ResearchGate
displays magnified views of the EEG data channels. To adjust the time range shown, select eegplot() menu item Settings > Time range to ......
Read more >
Topographical mapping - YouTube
This video lesson is part of a complete course on neuroscience time series analyses.The full course includes - over 47 hours of video ......
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