OverflowError when visualizing source estimates

  • MNE version: 1.1.1
  • operating system: Windows 10

Dear all,

I am trying to plot source estimates and from time to time get this error:

OverflowError: argument 1 overflowed: value must be in the range -2147483648 to 2147483647

Code for figure:
fig = stc.plot(hemi='both', views=['dorsal', 'ventral'], clim=dict(kind='value', pos_lims=lims), **kwargs)
I create stc like this:
stc = mne.beamformer.apply_lcmv(evoked_theta, filters)

Could you please help me, where I should look for to avoid this error?
I will be happy to provide more snippets of code is needed.

Best,
Katya

Could you see if you get the same error with the mne sample data please?

Alternatively if you do stc.data /= 1000 that might fix it just for visualization if you don’t care about the absolute amplitude.

1 Like

I played with the parameters and it turns out that the OverflowError occurs only when I apply Hilbert transform to get the envelope of the signal.

stc = mne.beamformer.apply_lcmv(epochs.copy().pick_types(meg='grad').filter(4., 8.).apply_hilbert(envelope=True).average(), filters)

If it is just the visualization issue, it does not bother me that much actually. I was afraid that I am getting distorted results.

I don’t know the about visualization component - but I believe you should project the complex hilbert signal epochs (not envelope) through the filters and then perform the envelope calculation and averaging at the STC level.

I think this is because the envelope does not have the same covariance as the underlying signal, so the filters are not tuned for the envelope.

1 Like