Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when plotting signal with 3 navigation dimensions #63

Closed
magnunor opened this issue Jun 21, 2023 · 1 comment
Closed

Error when plotting signal with 3 navigation dimensions #63

magnunor opened this issue Jun 21, 2023 · 1 comment

Comments

@magnunor
Copy link
Contributor

Using the most recent RELEASE_next_major in HyperSpy, most recent main in hyperspy_gui_ipywidgets and hyperspy_gui_traitsui. The following gives an error in JupyterLab:

%matplotlib widget
import numpy as np
import hyperspy.api as hs
s = hs.signals.Signal2D(np.random.random((5, 10, 10, 20, 20)))
s.plot()

The error:

hyperspy_gui_traitsui/hyperspy_gui_traitsui/__init__.py:94
     90 elif ETSConfig.toolkit == "":
     91     # The toolkit has not been set and no supported toolkit is available, so
     92     # setting it to "null"
     93     set_ets_toolkit("null")
---> 94     if preferences.GUIs.warn_if_guis_are_missing:
     95         _logger.warning(
     96             f"The {backend} matplotlib backend is not compatible with the "
     97             "traitsui GUI elements. For more information, read "
     98             "http://hyperspy.readthedocs.io/en/stable/user_guide/getting_started.html#possible-warnings-when-importing-hyperspy"
     99             ".")

AttributeError: 'GUIs' object has no attribute 'warn_if_guis_are_missing'

Running the s.plot() again does not give an error.


The following does not give an error (in JupyterLab):

%matplotlib widget
import numpy as np
import hyperspy.api as hs
s = hs.signals.Signal2D(np.random.random((10, 10, 20, 20)))
s.plot()

The following does not give an error (in JupyterLab):

%matplotlib qt5
import numpy as np
import hyperspy.api as hs
s = hs.signals.Signal2D(np.random.random((5, 10, 10, 20, 20)))
s.plot()

I'm guessing it is due to this line: https://github.com/hyperspy/hyperspy_gui_traitsui/blob/main/hyperspy_gui_traitsui/__init__.py#L94

However, I'm guessing there is something strange going on elsewhere, as it only happens with the signal with 3 navigation dimensions.

@ericpre ericpre transferred this issue from hyperspy/hyperspy Jul 5, 2023
@ericpre
Copy link
Member

ericpre commented Jul 5, 2023

This should be in fixed in #58 and not merged yet to avoid having to deal with a separate branch for the RELEASE_next_branch of hyperspy.

@ericpre ericpre closed this as completed Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants