AttributeError in "Transform EEG data using current source density (CSD)" example

  • MNE version: 1.5.1
  • operating system: Windows 11

Hi, I’m trying to run the " Transform EEG data using current source density (CSD)" example in Python, but some graphs are not generated because it returns multiple AttributeErrors. I would like to know how to fix it, if I need to install another dependency or something. The errors occur on lines 53 and 54, and on lines 74 to 77.
I’ll really appreciate if anyone can help me.

lines 53 and 54:
raw.compute_psd().plot(picks=“data”, exclude=“bads”)
raw_csd.compute_psd().plot(picks=“data”, exclude=“bads”)

lines 74 to 77:
times = np.array([-0.1, 0.0, 0.05, 0.1, 0.15])
evoked_csd = mne.preprocessing.compute_current_source_density(evoked)
evoked.plot_joint(title=“Average Reference”, show=False)
evoked_csd.plot_joint(title=“Current Source Density”)

Hello,

Could you share the entire error traceback?

Mathieu

Sure:

Traceback (most recent call last):

File ~\mne-python\1.5.1_0\Lib\site-packages\IPython\core\formatters.py:340 in call
return printer(obj)

File ~\mne-python\1.5.1_0\Lib\site-packages\IPython\core\pylabtools.py:152 in print_figure
fig.canvas.print_figure(bytes_io, **kw)

File ~\mne-python\1.5.1_0\Lib\site-packages\matplotlib\backend_bases.py:2353 in print_figure
restore_bbox = _tight_bbox.adjust_bbox(

File ~\mne-python\1.5.1_0\Lib\site-packages\matplotlib_tight_bbox.py:28 in adjust_bbox
ax.apply_aspect(locator(ax, None))

File ~\mne-python\1.5.1_0\Lib\site-packages\mpl_toolkits\axes_grid1\inset_locator.py:73 in call
bbox = self.get_window_extent(renderer)

File ~\mne-python\1.5.1_0\Lib\site-packages\matplotlib\offsetbox.py:399 in get_window_extent
renderer = self.figure._get_renderer()

AttributeError: ‘NoneType’ object has no attribute ‘_get_renderer’

Thanks for the help.

Please downgrade matplotlib to 3.7.1 or upgrade to latest (maybe?). This is not an MNE-Python bug, see: Jupyter yields: 'NoneType' object has no attribute '_get_renderer' · Issue #11799 · mne-tools/mne-python · GitHub

1 Like