Skip to content

[BUG] Showing multiple imvizes in one cell freezes all the image viewers #3472

@eteq

Description

@eteq

Jdaviz component

Imviz

Description

Am seeing some strange behavior when I create multiple Imviz instances and try to show them in the same cell. For example,

imvizes = []
for data in something:
    imviz = Imviz()
    imviz.load_data(...)
    imvizes.append(imviz)

for imviz in imvizes:
    imviz.show('...')

At least for me, when I do this, the imvizes all get shown, but they all have the same image showing in them even if I have separate data loaded, and when I pan/zoom around, the images don't update. Basically it seems like the js UI is disconnected from the kernel or something.

By contrast, if I instead do:

Cell[1]
i = iter(imvizes)
Cell[2]
next(i).show('sidecar')

and execute Cell 2 repeatedly until the iterator ends... it works fine! Similarly, if I do something like:

Cell[1]
imvizes[0].show('inline')
Cell[2]
imvizes[1].show('inline')

they both show up in their respective cells just fone.

How to Reproduce

  1. Install jdaviz
  2. Create at least two Imviz objects and load data into them
  3. Do something like this in the same cell:
for imviz in imvizes:
    imviz.show('...')
  1. Try to interact with the imviz that gets shown

Expected behavior

The separate calls to show should yield functional imviz instances.

Browser

Chrome 133.0.6943.142

Jupyter

IPython : 8.32.0
ipykernel : 6.29.5
ipywidgets : 8.1.5
jupyter_client : 8.6.3
jupyter_core : 5.7.2
jupyter_server : 2.15.0
jupyterlab : 4.3.5
nbclient : 0.10.2
nbconvert : 7.16.6
nbformat : 5.10.4
notebook : 7.3.2
qtconsole : not installed
traitlets : 5.14.3

Software versions

macOS-14.7.4-arm64-arm-64bit
Python 3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:19:53) [Clang 18.1.8 ]
Numpy 1.26.4
astropy 7.0.0
matplotlib 3.10.0
scipy 1.15.1
scikit-image 0.25.1
asdf 4.1.0
stdatamodels 2.2.0
gwcs 0.22.1
regions 0.10
specutils 1.19.0
specreduce 1.4.1
photutils 2.1.0
astroquery 0.4.9.post1
pyyaml 6.0.2
asteval 1.0.6
idna 3.10
traitlets 5.14.3
bqplot 0.12.43
bqplot-image-gl 1.6.1
glue-core 1.21.1
glue-jupyter 0.23.1
glue-astronomy 0.10.0
echo 0.9.0
ipyvue 1.11.2
ipyvuetify 1.10.0
ipysplitpanes 0.2.0
ipygoldenlayout 0.4.0
ipypopout 2.0.0
Jinja2 3.1.5
solara 1.44.0
vispy 0.14.3
sidecar 0.7.0
Jdaviz 4.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions