CSD might break montage

External Email - Use Caution

Hello all,

I am applying CSD to my epoched data and want to compare the
distributions of the ERPs on the scalp before and after surface laplacian.

epochs_csd = mne.preprocessing.compute_current_source_density(epochs)

I use : mne.viz.plot_compare_evokeds([epochs.average()], picks='eeg',
axes='topo')
To plot before CSD, everything works fine but then I use :
mne.viz.plot_compare_evokeds([epochs_csd.average()], picks='csd',
axes='topo')
And then the channel order is preserved but the cartoon head is shrinked
to the lower left of the figure (see attached) making it impossible to read.

I am assuming that the montage is lost in the csd transform as
epoch.info prints me :
<Info | 11 non-empty values
  bads: []
  ch_names: Fp1, AF7, AF3, F1, F3, F5, F7, FT7, FC5, FC3, FC1, C1, C3,
C5, ...
  chs: 64 EEG
  custom_ref_applied: True
  dig: 712 items (3 Cardinal, 64 EEG, 645 Extra)
  file_id: 4 items (dict)
  highpass: 0.0 Hz
  lowpass: 40.0 Hz
  meas_date: 2019-06-06 11:46:59 UTC
  meas_id: 4 items (dict)
  nchan: 64
  projs: []
  sfreq: 1000.0 Hz
>

and epochs_csd.info :

<Info | 11 non-empty values
  bads: []
  ch_names: Fp1, AF7, AF3, F1, F3, F5, F7, FT7, FC5, FC3, FC1, C1, C3,
C5, ...
  chs: 64 CSD
  custom_ref_applied: True
  dig: 712 items (3 Cardinal, 64 EEG, 645 Extra)
  file_id: 4 items (dict)
  highpass: 0.0 Hz
  lowpass: 40.0 Hz
  meas_date: 2019-06-06 11:46:59 UTC
  meas_id: 4 items (dict)
  nchan: 64
  projs: []
  sfreq: 1000.0 Hz
>

Is there a quick workaround ?

Best,
Gabriel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: topo_csd.png
Type: image/png
Size: 68233 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200624/cf4e1a22/attachment-0001.png

External Email - Use Caution

The topomaps in the example don't show this problem, at least for
plot_topomap:

https://mne.tools/dev/auto_examples/preprocessing/plot_eeg_csd.html#sphx-glr-auto-examples-preprocessing-plot-eeg-csd-py

First, it's worth trying latest
<https://mne.tools/dev/install/advanced.html#using-the-development-version-of-mne-python-latest-master>
`master` branch rather than 0.20.x to see if we have fixed it already.

If that doesn't work, can you see if you can reproduce on the `sample`
dataset by modifying the example above? If not, there might be something
about your data in particular -- if you can turn this into some tiny script
(probably gist <https://gist.github.com/>) to demonstrate the problem and
share your data someone can take a look.

Eric

External Email - Use Caution

I was on the dev branch after the commit #7863 on CSD on github, but
even when updating to the master branch with the link you provided I
still have the same error.

I tried with the example in
https://mne.tools/dev/auto_examples/preprocessing/plot_eeg_csd.html#sphx-glr-auto-examples-preprocessing-plot-eeg-csd-py
Topomap works (as for my data actually) but when I use
mne.viz.plot_compare_evokeds([evoked_csd], picks='csd', axes='topo')
I have the same error. So it seems to be specific to plot_compare_evokeds

I posted a gist in case it's spares you or others some time
https://gist.github.com/GWeindel/2af99b1a3b07d2d75d8e27cbacdf741e

Best,
Gabriel

External Email - Use Caution

i had the same problem with evoked.plot_joint when i tried using the CSD
routine on epoched data then averaging into an Evoked object -- topography
wouldn't plot, just got a black circle in the bottom left of the panel
where a topomap should be. the evoked plot at the bottom plotted fine though

External Email - Use Caution

This looks to be a genuine bug, which I think I've narrowed down to mne.channels.layout.generate_2d_layout. I'll work on a fix. Gabriel, Sammi, if you have GitHub accounts you can subscribe to this issue to track progress: https://github.com/mne-tools/mne-python/issues/7933

-- dan
Daniel McCloy
https://dan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

??? Original Message ???

External Email - Use Caution

Hi Dan,

I saw that a fix for this was merged - what's the best way of getting this
into the version of mne that i'm using at the moment? im running 0.20.5 at
the moment

sorry to bug about this!
Sammi

External Email - Use Caution

hi Sammi,

try :

pip install -U https://github.com/mne-tools/mne-python/archive/master.zip

Alex

External Email - Use Caution

Thanks a lot! Out of interest, is there a (theoretical?) reason that
interactive topomaps aren't permitted for CSD type channels, only EEG/MEG ?
can't select a time-period from a joint_plot to get a topo, but unsure why
this might not be the case (unless it just hasn't been implemented yet?)

External Email - Use Caution

no particular reason AFAIK

it was never suggested

A

External Email - Use Caution

Hi Sammi,
pip install -U https://github.com/mne-tools/mne-python/archive/master.zip
will get you the latest development version, which includes the fix you want.

-- dan
Daniel McCloy
https://dan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

??? Original Message ???