Skip to content

Commit

Permalink
Merge branch 'main' of github.com:glue-viz/glue-jupyter into histogra…
Browse files Browse the repository at this point in the history
…m_ui
  • Loading branch information
CyclingNinja committed Jul 29, 2024
2 parents 139a5b6 + 6226254 commit 1878679
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 13 deletions.
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Full changelog

## v0.22.0 - 2024-06-26

<!-- Release notes generated using configuration in .github/release.yml at main -->
### What's Changed

#### New Features

* Add support for 3D VisPy viewers by @astrofrog in https://github.com/glue-viz/glue-jupyter/pull/453

#### Other Changes

* Allow viewers to use BasicJupyterToolbar subclasses by @astrofrog in https://github.com/glue-viz/glue-jupyter/pull/452
* Updated image hashes by @astrofrog in https://github.com/glue-viz/glue-jupyter/pull/454

**Full Changelog**: https://github.com/glue-viz/glue-jupyter/compare/v0.21.0...v0.22.0

## v0.21.0 - 2024-04-25

<!-- Release notes generated using configuration in .github/release.yml at main -->
Expand Down
31 changes: 25 additions & 6 deletions glue_jupyter/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def scatter2d(self, *, data=None, x=None, y=None, widget='bqplot', color=None,
view.layers[0].state.update_from_dict(layer_state)
return view

def scatter3d(self, *, data=None, x=None, y=None, z=None, show=True):
def scatter3d(self, *, data=None, x=None, y=None, z=None, widget='ipyvolume', show=True):
"""
Open an interactive 3d scatter plot viewer.
Expand All @@ -387,17 +387,26 @@ def scatter3d(self, *, data=None, x=None, y=None, z=None, show=True):
The attribute to show on the y axis.
z : str or `~glue.core.component_id.ComponentID`, optional
The attribute to show on the z axis.
widget : {'ipyvolume', 'vispy'}
Whether to use ipyvolume or VisPy as the front-end.
show : bool, optional
Whether to show the view immediately (`True`) or whether to only
show it later if the ``show()`` method is called explicitly
(`False`).
"""

from .ipyvolume import IpyvolumeScatterView
if widget == 'ipyvolume':
from .ipyvolume import IpyvolumeScatterView
viewer_cls = IpyvolumeScatterView
elif widget == 'vispy':
from glue_vispy_viewers.scatter.jupyter import JupyterVispyScatterViewer
viewer_cls = JupyterVispyScatterViewer
else:
raise ValueError("widget= should be 'ipyvolume' or 'vispy'")

data = validate_data_argument(self.data_collection, data)

view = self.new_data_viewer(IpyvolumeScatterView, data=data, show=show)
view = self.new_data_viewer(viewer_cls, data=data, show=show)
if x is not None:
x = data.id[x]
view.state.x_att = x
Expand Down Expand Up @@ -500,7 +509,7 @@ def profile1d(self, *, data=None, x=None, widget='bqplot', show=True):

return view

def volshow(self, *, data=None, x=None, y=None, z=None, show=True):
def volshow(self, *, data=None, x=None, y=None, z=None, widget='ipyvolume', show=True):
"""
Open an interactive volume viewer.
Expand All @@ -519,16 +528,26 @@ def volshow(self, *, data=None, x=None, y=None, z=None, show=True):
z : str or `~glue.core.component_id.ComponentID`, optional
The attribute to show on the z axis. This should be one of the
pixel axis attributes.
widget : {'ipyvolume', 'vispy'}
Whether to use ipyvolume or VisPy as the front-end.
show : bool, optional
Whether to show the view immediately (`True`) or whether to only
show it later if the ``show()`` method is called explicitly
(`False`).
"""
from .ipyvolume import IpyvolumeVolumeView

if widget == 'ipyvolume':
from .ipyvolume import IpyvolumeVolumeView
viewer_cls = IpyvolumeVolumeView
elif widget == 'vispy':
from glue_vispy_viewers.volume.jupyter import JupyterVispyVolumeViewer
viewer_cls = JupyterVispyVolumeViewer
else:
raise ValueError("widget= should be 'ipyvolume' or 'vispy'")

data = validate_data_argument(self.data_collection, data)

view = self.new_data_viewer(IpyvolumeVolumeView, data=data, show=show)
view = self.new_data_viewer(viewer_cls, data=data, show=show)

if x is not None:
x = data.id[x]
Expand Down
3 changes: 3 additions & 0 deletions glue_jupyter/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def app(dataxyz, datax, dataxz, data_volume, data_image):
SOLARA_INSTALLED = True


import vispy # noqa
vispy.use('jupyter_rfb')

# Tweak IPython's display to not print out lots of __repr__s for widgets to
# standard output. However, if we are using solara, we shouldn't do this as
# it seems to cause issues.
Expand Down
6 changes: 3 additions & 3 deletions glue_jupyter/tests/images/py311-test-visual.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"glue_jupyter.bqplot.image.tests.test_visual.test_contour_units[chromium]": "fa4f68c5c62e1437c1666c656ba02376396f6c75b6f7956f712c760569a2045b",
"glue_jupyter.bqplot.scatter.tests.test_visual.test_visual_scatter2d[chromium]": "fbdd9fe2649a0d72813c03e77af6233909df64207cb834f28da479f50b9e7a1d",
"glue_jupyter.bqplot.scatter.tests.test_visual.test_visual_scatter2d_density[chromium]": "d843a816a91e37cb0212c7caae913d7563f6c2eb42b49fa18345a5952e093b2f"
"glue_jupyter.bqplot.image.tests.test_visual.test_contour_units[chromium]": "53ed6a698cd0fe879f92a7c428e14878e80b2640a8e09d69bb82c3847041bfb9",
"glue_jupyter.bqplot.scatter.tests.test_visual.test_visual_scatter2d[chromium]": "91fe92465a858548adcfba167b4402c61b927dd4da61dd1ed486f9fed84d5915",
"glue_jupyter.bqplot.scatter.tests.test_visual.test_visual_scatter2d_density[chromium]": "d3bd7a7ff60cff14154f50bd75c5b8821cbd25009b01600691ca35b568783c43"
}
3 changes: 2 additions & 1 deletion glue_jupyter/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class IPyWidgetView(Viewer):

_layer_artist_container_cls = IPyWidgetLayerArtistContainer
_default_mouse_mode_cls = None
_toolbar_cls = BasicJupyterToolbar

inherit_tools = True
tools = []
Expand Down Expand Up @@ -149,7 +150,7 @@ def initialize_toolbar(self):

from glue.config import viewer_tool

self.toolbar = BasicJupyterToolbar(self)
self.toolbar = self._toolbar_cls(self)

# Need to include tools and subtools declared by parent classes unless
# specified otherwise
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ setup_requires =
setuptools_scm
install_requires =
glue-core>=1.20.0
glue-vispy-viewers>=1.0
glue-vispy-viewers[jupyter]>=1.2.1
notebook>=4.0
ipympl>=0.3.0
ipyvolume>=0.5.0
Expand Down Expand Up @@ -87,8 +87,8 @@ filterwarnings =
ignore::FutureWarning:traitlets.*:
# numpy/linalg/linalg.py:2514 (1.21) or numpy/core/_asarray.py:83 (1.19):
# `x = asarray(x)` - triggered by `example_volume` from `ipv.examples.ball()
ignore:Creating an ndarray from ragged nested sequences:numpy.VisibleDeprecationWarning:numpy.core.*:
ignore:Creating an ndarray from ragged nested sequences:numpy.VisibleDeprecationWarning:numpy.linalg.*:
ignore:Creating an ndarray from ragged nested sequences::numpy.core.*:
ignore:Creating an ndarray from ragged nested sequences::numpy.linalg.*:
ignore:'contextfilter' is renamed to 'pass_context':DeprecationWarning:
# potentially more serious, but possibly also only erratic - report them, but don't raise
# ignore:numpy.ndarray size changed:RuntimeWarning:astropy.*:
Expand Down

0 comments on commit 1878679

Please sign in to comment.