Skip to content

Commit

Permalink
Fix stretch histogram reset_limits (spacetelescope#2529)
Browse files Browse the repository at this point in the history
* fix percentile and bins when resetting limits requires glue-viz/glue#2455
* update glue-core pin to v1.16.0

---------

Co-authored-by: P. L. Lim <[email protected]>
Co-authored-by: Kyle Conroy <[email protected]>
  • Loading branch information
3 people authored and rosteen committed Nov 29, 2023
1 parent 4d9ccd8 commit 6d84817
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,6 @@ def state_attr_for_line_visible(state):
self.stretch_histogram.tools_nested.append(["jdaviz:stretch_bounds"])
self.stretch_histogram._initialize_toolbar(["jdaviz:stretch_bounds"])

# NOTE: this is a current workaround so the histogram viewer doesn't crash when replacing
# data. Note also that passing x=[0] fails on SOME machines, so we'll pass [0, 1] instead
self.stretch_histogram._add_data('ref', x=[0, 1])
self.stretch_histogram.layers['ref'].state.visible = False
self.stretch_histogram._add_data('histogram', x=[0, 1])

self.stretch_histogram.add_line('vmin', x=[0, 0], y=[0, 1], ynorm=True, color='#c75d2c')
Expand All @@ -490,6 +486,8 @@ def state_attr_for_line_visible(state):
color="#007BA1", # "inactive" blue
)
self.stretch_histogram.add_scatter('colorbar', x=[], y=[], ynorm='vmin', marker='square', stroke_width=33) # noqa: E501
self.stretch_histogram.viewer.state.update_bins_on_reset_limits = False
self.stretch_histogram.viewer.state.x_limits_percentile = 95
with self.stretch_histogram.figure.hold_sync():
self.stretch_histogram.figure.axes[0].label = 'pixel value'
self.stretch_histogram.figure.axes[0].num_ticks = 3
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies = [
"traitlets>=5.0.5",
"bqplot>=0.12.37",
"bqplot-image-gl>=1.4.11",
"glue-core>=1.14",
"glue-core>=1.16.0",
"glue-jupyter>=0.19",
"echo>=0.5.0",
"ipykernel>=6.19.4",
Expand Down

0 comments on commit 6d84817

Please sign in to comment.