XanaduAI / MrMustard

A differentiable bridge between phase space and Fock space
https://mrmustard.readthedocs.io/
Apache License 2.0
78 stars 27 forks source link

State visualizations are not shown #423

Closed JacobHast closed 3 months ago

JacobHast commented 4 months ago

Before posting a bug report

Expected behavior

When calling .visualize_2d() I expect a state to be shown

Actual behavior

A blank box is displayed instead of a figure. If I add the keyword argument return_fig=True, the figure gets shown as desired.

image

When e.g. calling a state in a jupyter notebook, also nothing is shown: image

Reproduces how often

100 % for me

System information

Mr Mustard: a differentiable bridge between phase space and Fock space.
Copyright 2021 Xanadu Quantum Technologies Inc.

Python version:            3.9.19
Platform info:             Windows-10-10.0.19045-SP0
Installation path:         
c:\Users\jacob\miniconda3\envs\mrmustard_dev\lib\site-packages\mrmustard
Mr Mustard version:        0.7.3
Numpy version:             1.26.4
Numba version:             0.59.1
Scipy version:             1.13.1
The Walrus version:        0.19.0
TensorFlow version:        2.16.1

Source code

No response

Tracebacks

No response

Additional information

No response

timmysilv commented 4 months ago

I've opened draft PR #425 to start fixing various issues in our new visualizations. this is a difference between Jupyter Lab/Notebooks (presumably where Sam was testing his stuff) and VS Code notebooks - it seems the latter doesn't love the HTML rendering that we're doing.

For now, my draft PR fixes the individual plots. However, it doesn't work yet for a State's default repr or the representations because those require HTML templating. State.visualize_xx should work (as if you passed return_fig=True, but I just removed that kwarg so it always does because it should).