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
Fix Axes3D object is not iterable [unitaryHACK] #1558
Conversation
Fixes the error TypeError: 'Axes3D' object is not iterable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix works great for me too! 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing blit=False Still does not work for me.
@rohan999chaudhary Could you share the error traceback? From the documentation, the default value for |
I get this error for dir_gen_anim2.py. I have just attached the relevant part here. fig = pyplot.figure()
ax = Axes3D(fig, azim=-40, elev=30)
sphere = Bloch(axes=ax)
def animate(i):
sphere.clear()
sphere.add_vectors([np_sin(theta), 0, np_cos(theta)])
sphere.add_points([sx[:i+1], sy[:i+1], sz[:i+1]])
sphere.make_sphere()
return ax
def init():
sphere.vector_color = ['r']
return ax
ani = FuncAnimation(fig, animate, arange(len(sx)),
init_func=init, blit=False, repeat=False)
ani.save('bloch_sphere.mp4', fps=20)
Exception ignored in: <function TimerQT.__del__ at 0x7fbf6c561b80>
Traceback (most recent call last):
File "/home/rohan/anaconda3/envs/nbdev/lib/python3.8/site-packages/matplotlib/backends/backend_qt5.py", line 189, in __del__
TypeError: 'NoneType' object is not callable |
and this in dir_gen_anim.py fig = figure()
ax = Axes3D(fig, azim=-40, elev=30)
sphere = Bloch(axes=ax)
def animate(i):
sphere.clear()
sphere.add_vectors([np_sin(theta), 0, np_cos(theta)])
sphere.add_points([sx[:i+1], sy[:i+1], sz[:i+1]])
sphere.make_sphere()
return ax
def init():
sphere.vector_color = ['r']
return ax
ani = FuncAnimation(fig, animate, arange(len(sx)),
init_func=init, blit=True, repeat=False)
ani.save('bloch_sphere.mp4', fps=20)
Traceback (most recent call last):
File "dir_gen_anim.py", line 87, in <module>
ani.save('bloch_sphere.mp4', fps=20)
File "/home/rohan/anaconda3/envs/nbdev/lib/python3.8/site-packages/matplotlib/animation.py", line 1144, in save
anim._init_draw() # Clear the initial frame
File "/home/rohan/anaconda3/envs/nbdev/lib/python3.8/site-packages/matplotlib/animation.py", line 1727, in _init_draw
for a in self._drawn_artists:
TypeError: 'Axes3D' object is not iterable |
This is my conda env file for linux name: nbdev
channels:
- fastai
- defaults
- conda-forge
dependencies:
- _r-mutex
- _tflow_select
- absl-py
- alabaster
- asn1crypto
- astor
- astroid
- attrs
- babel
- backcall
- backports
- backports.functools_lru_cache
- blas
- bleach
- bwidget
- bzip2
- c-ares
- ca-certificates
- cairo
- certifi
- cffi
- chardet
- cloudpickle
- compiler-rt
- constantly
- cryptography
- curl
- cycler
- cython
- dbus
- decorator
- defusedxml
- docutils
- entrypoints
- expat
- fastcache
- flake8
- fontconfig
- freetype
- fribidi
- gast
- gettext
- glib
- gmp
- gmpy2
- graphite2
- grpcio
- gsl
- h5py
- harfbuzz
- hdf5
- html5lib
- icu
- idna
- imagesize
- intel-openmp
- ipykernel
- ipython
- ipython_genutils
- isort
- jbig
- jedi
- jinja2
- jpeg
- jsonschema
- jupyter_client
- jupyter_contrib_core
- jupyter_contrib_nbextensions
- jupyter_core
- jupyter_highlight_selected_word
- jupyter_latex_envs
- jupyter_nbextensions_configurator
- keras-applications
- keras-preprocessing
- keyring
- krb5
- lazy-object-proxy
- libcurl
- libcxx
- libcxxabi
- libedit
- libffi
- libgcc
- libgfortran
- libiconv
- libopenblas
- libpng
- libprotobuf
- libsodium
- libssh2
- libtiff
- libxml2
- libxslt
- llvm
- llvm-openmp
- lxml
- make
- markdown
- markupsafe
- matplotlib
- mccabe
- mistune
- mkl
- mkl_fft
- mkl_random
- mock
- mpc
- mpfr
- mpmath
- nbconvert
- nbformat
- ncurses
- nomkl
- notebook
- numpy
- numpy-base
- numpydoc
- olefile
- openblas
- openblas-devel
- openssl
- packaging
- pandas
- pandoc
- pandocfilters
- pango
- pari
- parso
- patsy
- pbr
- pcre
- perl
- pexpect
- pickleshare
- pillow
- pip
- pixman
- prometheus_client
- prompt_toolkit
- protobuf
- psutil
- ptyprocess
- pycodestyle
- pycparser
- pyflakes
- pygments
- pylint
- pyopenssl
- pyparsing
- pyqt
- pyrsistent
- pysocks
- python
- python-dateutil
- python-symengine
- pytz
- pyyaml
- pyzmq
- qt
- qtawesome
- qtconsole
- qtpy
- qutip
- r-base
- r-clisymbols
- readline
- reportlab
- requests
- rope
- scikit-learn
- scipy
- send2trash
- setuptools
- simplegeneric
- sip
- six
- snowballstemmer
- sphinx
- sphinxcontrib
- sphinxcontrib-applehelp
- sphinxcontrib-devhelp
- sphinxcontrib-htmlhelp
- sphinxcontrib-jsmath
- sphinxcontrib-qthelp
- sphinxcontrib-serializinghtml
- sphinxcontrib-websupport
- spyder
- spyder-kernels
- sqlite
- symengine
- symmetrica
- sympow
- sympy
- tensorboard
- tensorflow
- tensorflow-base
- tensorflow-estimator
- termcolor
- terminado
- testpath
- tk
- tktable
- tornado
- traitlets
- typed-ast
- typing
- urllib3
- wcwidth
- webencodings
- werkzeug
- wheel
- wrapt
- wurlitzer
- xz
- yaml
- zeromq
- tqdm
- zlib
- zstd
- pytest
- numba
- hypothesis
- pytest-cov
- mypy
- pytest-xdist
- watchdog
- pytest-runner
- coveralls
- doctr
- gitpython
- pre-commit
- tox
- cookiecutter
- pdbpp
- sphinx-autobuild
- sphinx-autodoc-typehints
- sphinx_rtd_theme
- travis-encrypt
- twine
- nbval
- nbsphinx
- watermark
- ipyparallel
- unittest2pytest
- pytest-benchmark
- pytest-repeat
- pytest-subtests
- fastcore
- fastscript
- asttokens
- cached-property
- crayons
- executing
- flask
- humanize
- ipywidgets
- itsdangerous
- jsonpickle
- jupyter
- littleutils
- nbconvert
- outdated
- portpicker
- sqlalchemy
- widgetsnbextension
- nbdime
- rich
- mayavi
- pip:
- birdseye
- icecream
- nbdev==1.1.12
- snoop
- git-remote-dropbox
- odeintw
- cyberbrain
- cheap-repr
- jupyter-console
- get-port
- flask-humanize
- msgpack
- jupyterlab-widgets
prefix: /anaconda3/envs/nbdev
|
Fix Axes3D object is not iterable [unitaryHACK].
Description
Fixes TypeError: 'Axes3D' object is not iterable when running the code from the tutorial.
Related issues or PRs
#799
Changelog
Fixed runtime error in http://qutip.org/docs/latest/guide/guide-bloch.html#generating-images-for-animation