diff --git a/CHANGES.rst b/CHANGES.rst index 34b437e91a..2c44f8b8b6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,9 @@ Imviz - The stretch histogram within plot options can now be popped-out into its own window. [#2314] +- vmin/vmax step size in the plot options plugin is now dynamic based on the full range of the + image. [#2388] + - Footprints plugin for plotting overlays of instrument footprints in the image viewer. [#2341] Mosviz diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index 6a2bb65a63..b75acf75e1 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -187,6 +187,8 @@ class PlotOptions(PluginTemplateMixin): stretch_preset_value = Any().tag(sync=True) # glue will pass either a float or string stretch_preset_sync = Dict().tag(sync=True) + stretch_vstep = Float(0.1).tag(sync=True) # dynamic based on full range from image + stretch_vmin_value = Float().tag(sync=True) stretch_vmin_sync = Dict().tag(sync=True) @@ -621,6 +623,12 @@ def _update_stretch_histogram(self, msg={}): if len(sub_data) > 0: hist_lims = interval.get_limits(sub_data) hist_mark.min, hist_mark.max = hist_lims + # set the stepsize for vmin/vmax to be approximately 1% of the range of the + # histogram (within the percentile interval), rounded to 1-2 significant digits + # to avoid random step sizes. This logic is somewhat arbitrary and can be safely + # modified or eventually exposed to the user if that would be useful. + stretch_vstep = (hist_lims[1] - hist_lims[0]) / 100. + self.stretch_vstep = np.round(stretch_vstep, decimals=-int(np.log10(stretch_vstep))+1) # noqa hist_mark.bins = self.stretch_hist_nbins # in case only the sample has changed but its length has not, # we'll force the traitlet to trigger a change diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.vue b/jdaviz/configs/default/plugins/plot_options/plot_options.vue index 55ce464cee..26b2e4a21c 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.vue +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.vue @@ -341,11 +341,25 @@ - + - +