spacetelescope / jdaviz

JWST astronomical data analysis tools in the Jupyter platform
https://jdaviz.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
142 stars 74 forks source link

[BUG] jdaviz will only show once in vs code and gives spurious error about window size #3250

Open eteq opened 3 weeks ago

eteq commented 3 weeks ago

Jdaviz component

Other (explain in Description below)

Description

I was testing running a jupyter notebook in VS Code and showing jdaviz. The first surprise was: the basic workflow works flawlessly!: screenshot-2024-10-23-20-58-06

and all the interactions, etc work fine.

However, then I ran into a problem illustrated here: screenshot-2024-10-23-20-59-03

if you take the cell that show() was done in, and get rid of its output (in this case be re-running it with a different cell content, although just deleting the cell also works), it gives this error that seems to indicate some sort of windowing math is not working as expected.

More importantly, any subsequent call to .show() doesn't show anything, so one is forced to restart the notebook.

How to Reproduce

  1. Create or open a jupyter notebook in VS code
  2. run the snippet shown above
  3. delete the output cell (or replace it with something else)

Expected behavior

The cell should be removable without error, and subsequent calls to .show() should just happily proceed along.

Browser

No response

Jupyter

Selected Jupyter core packages... IPython : 8.28.0 ipykernel : 6.29.5 ipywidgets : 8.1.5 jupyter_client : 8.6.3 jupyter_core : 5.7.2 jupyter_server : 2.14.2 jupyterlab : 4.2.5 nbclient : 0.10.0 nbconvert : 7.16.4 nbformat : 5.10.4 notebook : 7.2.2 qtconsole : not installed traitlets : 5.14.3

Software versions

import sys; print("Python", sys.version) Python 3.12.7 | packaged by conda-forge | (main, Oct 4 2024, 16:05:46) [GCC 13.3.0] import numpy; print("Numpy", numpy.version) Numpy 2.1.2 import astropy; print("astropy", astropy.version) astropy 6.1.4 import matplotlib; print("matplotlib", matplotlib.version) matplotlib 3.9.2 import scipy; print("scipy", scipy.version) scipy 1.14.1 import skimage; print("scikit-image", skimage.version) scikit-image 0.24.0 import asdf; print("asdf", asdf.version) asdf 3.5.0 import stdatamodels; print("stdatamodels", stdatamodels.version) stdatamodels 1.10.1 import gwcs; print("gwcs", gwcs.version) gwcs 0.21.0 import regions; print("regions", regions.version) regions 0.10 import specutils; print("specutils", specutils.version) specutils 1.18.0 import specreduce; print("specreduce", specreduce.version) specreduce 1.4.1 import photutils; print("photutils", photutils.version) photutils 2.0.1 import astroquery; print("astroquery", astroquery.version) astroquery 0.4.7 import yaml; print("pyyaml", yaml.version) pyyaml 6.0.2 import asteval; print("asteval", asteval.version) asteval 1.0.5 import idna; print("idna", idna.version) idna 3.10 import traitlets; print("traitlets", traitlets.version) traitlets 5.14.3 import bqplot; print("bqplot", bqplot.version) bqplot 0.12.43 import bqplot_image_gl; print("bqplot-image-gl", bqplot_image_gl.version) bqplot-image-gl 1.5.0 import glue; print("glue-core", glue.version) glue-core 1.21.1 import glue_jupyter; print("glue-jupyter", glue_jupyter.version) glue-jupyter 0.23.0 import glue_astronomy; print("glue-astronomy", glue_astronomy.version) glue-astronomy 0.10.0 import echo; print("echo", echo.version) echo 0.9.0 import ipyvue; print("ipyvue", ipyvue.version) ipyvue 1.11.1 import ipyvuetify; print("ipyvuetify", ipyvuetify.version) ipyvuetify 1.10.0 import ipysplitpanes; print("ipysplitpanes", ipysplitpanes.version) ipysplitpanes 0.2.0 import ipygoldenlayout; print("ipygoldenlayout", ipygoldenlayout.version) ipygoldenlayout 0.4.0 import ipypopout; print("ipypopout", ipypopout.version) ipypopout 2.0.0 import jinja2; print("Jinja2", jinja2.version) Jinja2 3.1.4 import solara; print("solara", solara.version) solara 1.40.0 import vispy; print("vispy", vispy.version) vispy 0.14.3 import sidecar; print("sidecar", sidecar.version) sidecar 0.7.0 import jdaviz; print("Jdaviz", jdaviz.version) Jdaviz 4.0.0

kecnry commented 1 week ago

I can reproduce the division by zero traceback by removing the output - from full traceback, this seems to be triggered by bqplot-image-gl, not jdaviz. Note though that subsequent .show() calls do work on my end, which then makes the traceback pretty harmless since it doesn't affect future widget instances - but at the least could be confusing for users who run into this case. Any ideas @maartenbreddels?

eteq commented 4 days ago

Hmm, strange: I agree with the above now! That is, subsequent calls to show() do work. There is a bit of a delay (not terribly problematic, just a bit slower than in the notebook), so maybe I just didn't wait long enough the first time I tried it?

Anyway, sounds like this is just the div by zero problem, which is upstream fix required? Added label accordingly.