Skip to content

Commit

Permalink
feat: Choose 'png' image compression in BqplotImageView by default (#470
Browse files Browse the repository at this point in the history
)

* choose 'png' image compression by default

* updating hashes with compression

* Restore scatter2d hashes

* another stab at py311-test-visual.json

---------

Co-authored-by: Derek Homeier <[email protected]>
  • Loading branch information
bmorris3 and dhomeier authored Oct 18, 2024
1 parent ff6f473 commit b7ca61f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions glue_jupyter/bqplot/image/frb_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class FRBImage(ImageGL):

def __init__(self, viewer, array_maker):
def __init__(self, viewer, array_maker, compression='png'):

# FIXME: need to use weakref to avoid circular references
self.viewer = viewer
Expand All @@ -29,7 +29,7 @@ def __init__(self, viewer, array_maker):
'y': self.viewer.scale_y,
'image': self.scale_image}

super().__init__(image=EMPTY_IMAGE, scales=self.scales)
super().__init__(image=EMPTY_IMAGE, scales=self.scales, compression=compression)

self.array_maker = array_maker

Expand Down
4 changes: 2 additions & 2 deletions glue_jupyter/bqplot/image/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class BqplotImageView(BqplotBaseView):
tools = ['bqplot:home', 'bqplot:panzoom', 'bqplot:rectangle', 'bqplot:circle',
'bqplot:ellipse', 'bqplot:polygon', 'bqplot:lasso']

def __init__(self, session):
def __init__(self, session, compression='png'):

super(BqplotImageView, self).__init__(session)

self.shape = None

self._composite = CompositeArray()
self._composite_image = FRBImage(self, self._composite)
self._composite_image = FRBImage(self, self._composite, compression=compression)
self.figure.marks = list(self.figure.marks) + [self._composite_image]
self.state.add_callback('reference_data', self._reset_limits, echo_old=True)
self.state.add_callback('x_att', self._reset_limits, echo_old=True)
Expand Down
4 changes: 2 additions & 2 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]": "53ed6a698cd0fe879f92a7c428e14878e80b2640a8e09d69bb82c3847041bfb9",
"glue_jupyter.bqplot.image.tests.test_visual.test_contour_units[chromium]": "94a99faec5500df042edde00e9cdef58e230d68e9a762c1cd0ed0499eb0de83f",
"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"
}
}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install_requires =
ipywidgets>=7.4.0
ipyvue>=1.2.0,<2
ipyvuetify>=1.2.0,<2
bqplot-image-gl>=1.4.3
bqplot-image-gl>=1.5.0
bqplot>=0.12.17
bqplot-gl
scikit-image
Expand Down

0 comments on commit b7ca61f

Please sign in to comment.