8000 `s.remove_background()` does not work with newest matplotlib · Issue #2195 · hyperspy/hyperspy · GitHub
[go: up one dir, main page]

Skip to content
s.remove_background() does not work with newest matplotlib #2195
@jat255

Description

@jat255

I just tried a new install on Python 3.7 and matplotlib 3.1 in Anaconda on Windows, and got the following error when running through the EELS example notebook:

s.remove_background(fast=False)

C:\Users\jat\anaconda3\envs\hyperspy_tut\lib\site-packages\hyperspy\drawing\_widgets\range.py:285: MatplotlibDeprecationWarning: 
The buttonDown attribute was deprecated in Matplotlib 3.1 and will be removed in 3.3.
  self.buttonDown = False

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-bffcaf2cd58d> in <module>
----> 1 s.remove_background(fast=False)

~\anaconda3\envs\hyperspy_tut\lib\site-packages\hyperspy\_signals\signal1d.py in remove_background(self, signal_range, background_type, polynomial_order, fast, zero_fill, plot_remainder, show_progressbar, display, toolkit)
   1075                                    plot_remainder=plot_remainder,
   1076                                    show_progressbar=show_progressbar,
-> 1077                                    zero_fill=zero_fill)
   1078             return br.gui(display=display, toolkit=toolkit)
   1079         else:

~\anaconda3\envs\hyperspy_tut\lib\site-packages\hyperspy\signal_tools.py in __init__(self, signal, background_type, polynomial_order, fast, plot_remainder, zero_fill, show_progressbar)
    672                  fast=True, plot_remainder=True, zero_fill=False,
    673                  show_progressbar=None):
--> 674         super(BackgroundRemoval, self).__init__(signal)
    675         # setting the polynomial order will change the backgroud_type to
    676         # polynomial, so we set it before setting the background type

~\anaconda3\envs\hyperspy_tut\lib\site-packages\hyperspy\signal_tools.py in __init__(self, signal)
     52         self.span_selector = None
     53         self.signal.plot()
---> 54         self.span_selector_switch(on=True)
     55 
     56     def on_disabling_span_selector(self):

~\anaconda3\envs\hyperspy_tut\lib\site-packages\hyperspy\signal_tools.py in span_selector_switch(self, on)
     66                     self.signal._plot.signal_plot.ax,
     67                     onselect=self.update_span_selector_traits,
---> 68                     onmove_callback=self.update_span_selector_traits,)
     69 
     70         elif self.span_selector is not None:

~\anaconda3\envs\hyperspy_tut\lib\site-packages\hyperspy\drawing\_widgets\range.py in __init__(self, ax, **kwargs)
    283         self.step_ax = None
    284         self.bounds_check = False
--> 285         self.buttonDown = False
    286         self.snap_size = False
    287         self.snap_position = False

~\anaconda3\envs\hyperspy_tut\lib\site-packages\matplotlib\cbook\deprecation.py in __set__(self, instance, value)
    216                         from . import _warn_external
    217                         _warn_external(warning)
--> 218                     return super().__set__(instance, value)
    219 
    220                 def __delete__(self, instance):

AttributeError: can't set attribute

I'm not sure why it is raising an error, since it says that it is supposed to be a warning until v3.3, but this makes EELS background removal currently broken with a new installation.

Installing v3.0.3 from conda-forge via conda install matplotlib=3.0 -c conda-forge appears to be a workaround.

Package list:

(hyperspy_tut) λ conda list
WARNING: The conda.compat module is deprecated and will be removed in a future release.
# packages in environment at C:\Users\jat\anaconda3\envs\hyperspy_tut:
#
# Name                    Version                   Build  Channel
asn1crypto                0.24.0                py37_1003    conda-forge
attrs                     19.1.0                     py_0    conda-forge
autopep8                  1.4.4                      py_0    conda-forge
backcall                  0.1.0                      py_0    conda-forge
blas                      1.0                         mkl
bleach                    3.1.0                      py_0    conda-forge
bokeh                     1.2.0                    py37_0    conda-forge
ca-certificates           2019.3.9             hecc5488_0    conda-forge
certifi                   2019.3.9                 py37_0    conda-forge
cffi                      1.12.3           py37hb32ad35_0    conda-forge
chardet                   3.0.4                 py37_1003    conda-forge
click                     7.0                        py_0    conda-forge
cloudpickle               1.0.0                      py_0    conda-forge
colorama                  0.4.1                      py_0    conda-forge
cryptography              2.6.1            py37hb32ad35_0    conda-forge
cycler                    0.10.0                     py_1    conda-forge
cytoolz                   0.9.0.1         py37hfa6e2cd_1001    conda-forge
dask                      1.2.2                      py_2    conda-forge
dask-core                 1.2.2                      py_0    conda-forge
decorator                 4.4.0                      py_0    conda-forge
defusedxml                0.5.0                      py_1    conda-forge
dill                      0.2.9                    py37_0    conda-forge
distributed               1.28.1                   py37_0    conda-forge
docutils                  0.14                  py37_1001    conda-forge
entrypoints               0.3                   py37_1000    conda-forge
fastcache                 1.1.0            py37hfa6e2cd_0    conda-forge
ffmpeg                    4.1.3                h6538335_0    conda-forge
freetype                  2.10.0               h5db478b_0    conda-forge
future                    0.17.1                py37_1000    conda-forge
h5py                      2.9.0           nompi_py37h3cb27cb_1102    conda-forge
hdf5                      1.10.4          nompi_hcc15c50_1106    conda-forge
heapdict                  1.0.0                 py37_1000    conda-forge
hyperspy                  1.4.1                 py37_1002    conda-forge
hyperspy-base             1.4.1           py37hfa6e2cd_1002    conda-forge
hyperspy-gui-ipywidgets   1.1.1                      py_1    conda-forge
hyperspy-gui-traitsui     1.1.1                 py37_1000    conda-forge
hyperspyui                1.1.0                      py_0    conda-forge
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.1                     vc14_0    conda-forge
idna                      2.8                   py37_1000    conda-forge
imageio                   2.5.0                    py37_0    conda-forge
intel-openmp              2019.3                      203
ipykernel                 5.1.1            py37h39e3cac_0    conda-forge
ipyparallel               6.2.4                    py37_0    conda-forge
ipython                   7.5.0            py37h39e3cac_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.4.2                      py_0    conda-forge
jedi                      0.13.3                   py37_0    conda-forge
jinja2                    2.10.1                     py_0    conda-forge
joblib                    0.13.2                     py_0    conda-forge
jpeg                      9c                hfa6e2cd_1001    conda-forge
jsonschema                3.0.1                    py37_0    conda-forge
jupyter                   1.0.0                      py_2    conda-forge
jupyter_client            5.2.4                      py_3    conda-forge
jupyter_console           6.0.0                      py_0    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge
jupyterlab                0.35.6                   py37_0    conda-forge
jupyterlab_server         0.2.0                      py_0    conda-forge
kiwisolver                1.1.0            py37he980bc4_0    conda-forge
libblas                   3.8.0                    10_mkl    conda-forge
libcblas                  3.8.0                    10_mkl    conda-forge
liblapack                 3.8.0                    10_mkl    conda-forge
libpng                    1.6.37               h7602738_0    conda-forge
libsodium                 1.0.16            h2fa13f4_1001    conda-forge
libtiff                   4.0.10            h6512ee2_1003    conda-forge
link-traits               1.0.2                 py37_1002    conda-forge
llvmlite                  0.28.0                   py37_0    conda-forge
locket                    0.2.0                      py_2    conda-forge
lz4-c                     1.8.3             he025d50_1001    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gmp                 6.1.0                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
markupsafe                1.1.1            py37hfa6e2cd_0    conda-forge
matplotlib                3.1.0                    py37_1    conda-forge
matplotlib-base           3.1.0            py37h2852a4a_1    conda-forge
mistune                   0.8.4           py37hfa6e2cd_1000    conda-forge
mkl                       2019.3                      203
mpmath                    1.1.0                      py_0    conda-forge
msgpack-python            0.6.1            py37he980bc4_0    conda-forge
msys2-conda-epoch         20160418                      1
natsort                   6.0.0                      py_0    conda-forge
nbconvert                 5.5.0                      py_0    conda-forge
nbformat                  4.4.0                      py_1    conda-forge
networkx                  2.3                        py_0    conda-forge
nodejs                    11.14.0                       1    conda-forge
notebook                  5.7.8                    py37_1    conda-forge
numba                     0.43.1           py37hf9181ef_0
numexpr                   2.6.9           py37h6538335_1000    conda-forge
numpy                     1.16.3           py37h873a0b8_0    conda-forge
olefile                   0.46                       py_0    conda-forge
openssl                   1.1.1b               hfa6e2cd_2    conda-forge
packaging                 19.0                       py_0    conda-forge
pandas                    0.24.2           py37he350917_0    conda-forge
pandoc                    2.7.2                         0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
parso                     0.4.0                      py_0    conda-forge
partd                     0.3.9                      py_0    conda-forge
patsy                     0.5.1                      py_0    conda-forge
pep8                      1.7.1                      py_0    conda-forge
pickleshare               0.7.5                 py37_1000    conda-forge
pillow                    6.0.0            py37h9a613e6_0    conda-forge
pint                      0.9                      py37_2    conda-forge
pip                       19.1.1                   py37_0    conda-forge
prometheus_client         0.6.0                      py_0    conda-forge
prompt_toolkit            2.0.9                      py_0    conda-forge
psutil                    5.6.2            py37hfa6e2cd_0    conda-forge
pycodestyle               2.5.0                      py_0    conda-forge
pycparser                 2.19                     py37_1    conda-forge
pyface                    6.1.0                      py_1    conda-forge
pyflakes                  2.1.1                      py_0    conda-forge
pygments                  2.4.2                      py_0    conda-forge
pyopenssl                 19.0.0                   py37_0    conda-forge
pyparsing                 2.4.0                      py_0    conda-forge
pyqode.core               2.12.0             pyh8a2030e_0    conda-forge
pyqode.python             2.12.0             pyh8a2030e_0    conda-forge
pyqode.qt                 2.10.0             pyh8a2030e_0    conda-forge
pyqt                      5.9.2            py37h6538335_0    conda-forge
pyreadline                2.1                   py37_1000    conda-forge
pyrsistent                0.15.2           py37hfa6e2cd_0    conda-forge
pysocks                   1.7.0                    py37_0    conda-forge
python                    3.7.3                hb12ca83_0    conda-forge
python-dateutil           2.8.0                      py_0    conda-forge
pytz                      2019.1                     py_0    conda-forge
pywavelets                1.0.3            py37h452e1ab_1    conda-forge
pywinpty                  0.5.5                 py37_1000    conda-forge
pyyaml                    5.1              py37hfa6e2cd_0    conda-forge
pyzmq                     18.0.1           py37he7828b0_1    conda-forge
qt                        5.9.7                hc6833c9_1    conda-forge
qtconsole                 4.5.1                      py_0    conda-forge
qtpy                      1.7.1              pyhde82777_0    conda-forge
requests                  2.22.0                   py37_0    conda-forge
scikit-image              0.15.0           py37h6538335_0    conda-forge
scikit-learn              0.21.2           py37h0ff8352_0    conda-forge
scipy                     1.2.1            py37h29ff71c_0
send2trash                1.5.0                      py_0    conda-forge
setuptools                41.0.1                   py37_0    conda-forge
sip                       4.19.8          py37h6538335_1000    conda-forge
six                       1.12.0                py37_1000    conda-forge
sortedcontainers          2.1.0                      py_0    conda-forge
sparse                    0.7.0                      py_0    conda-forge
sqlite                    3.28.0               hfa6e2cd_0    conda-forge
statsmodels               0.9.0           py37hfa6e2cd_1000    conda-forge
sympy                     1.4                      py37_0    conda-forge
tblib                     1.4.0                      py_0    conda-forge
terminado                 0.8.2                    py37_0    conda-forge
testpath                  0.4.2                   py_1001    conda-forge
tk                        8.6.9             hfa6e2cd_1001    conda-forge
toolz                     0.9.0                      py_1    conda-forge
tornado                   6.0.2            py37hfa6e2cd_0    conda-forge
tqdm                      4.32.1                     py_0    conda-forge
traitlets                 4.3.2                 py37_1000    conda-forge
traits                    5.1.1            py37hfa6e2cd_0    conda-forge
traitsui                  6.1.0                      py_0    conda-forge
urllib3                   1.24.3                   py37_0    conda-forge
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.15.26706          h3a45250_4
wcwidth                   0.1.7                      py_1    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.33.4                   py37_0    conda-forge
widgetsnbextension        3.4.2                 py37_1000    conda-forge
win_inet_pton             1.1.0                    py37_0    conda-forge
wincertstore              0.2                   py37_1002    conda-forge
winpty                    0.4.3                         4    conda-forge
xz                        5.2.4             h2fa13f4_1001    conda-forge
yaml                      0.1.7             hfa6e2cd_1001    conda-forge
zeromq                    4.3.1             he025d50_1000    conda-forge
zict                      0.1.4                      py_0    conda-forge
zlib                      1.2.11            h2fa13f4_1004    conda-forge
zstd                      1.4.0                hd8a0e53_0    conda-forge

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0