-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consolidate stretch histogram code #2538
Conversation
* and remove multilayer support
@@ -726,23 +739,24 @@ def _update_stretch_histogram(self, msg={}): | |||
|
|||
# update the n_bins since this may be a new layer | |||
self._histogram_nbins_changed() | |||
# update the curve/colorbar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think colorbar and stretch curve listen to exactly the same events? For example, colorbar needs to match the bins on histogram but not necessarily the curve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, we can skip sections based on the event if performance is an issue/concern, but I think this is cleaner than having duplicated code and multiple callbacks (in unpredictable order) for the ones that are shared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are blocks you think we should skip under certain scenarios, please suggest any changes (msg.get('name')
should give the name of the traitlet causing the method to be triggered)!
Codecov ReportAttention:
... and 2 files with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
I saw things but they are not related:
At some point, the colorbar scatter plot got messed up as if I reduced the number of bins but I didn't; however I am unable to reproduce this as I was doing a bunch of things and I don't remember what or the order. |
'stretch_function_value', 'stretch_vmin_value', 'stretch_vmax_value', | ||
'stretch_hist_nbins', 'stretch_hist_zoom_limits') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we don't need 'stretch_hist_zoom_limits'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'is_active', 'layer_selected', 'viewer_selected', 'stretch_hist_zoom_limits'
all trigger _update_stretch_histogram
, which in turn will call this after updating the histogram bins themselves.
# but may be added in the future. If it is not in the registry, we'll add it now. If/once the | ||
# min-pin of glue-jupyter includes this in the registry, we can safely remove this block. | ||
# but may be added in the future. If it is not in the registry, we'll add it now. | ||
# Once glue-jupyter with https://github.com/glue-viz/glue-jupyter/pull/402 is pinned, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you know the version to pin to, please also document it here. Or open issue so we don't forget. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know the version yet (likely the next minor release, which would be 0.20.0, but can't be sure... I guess anything after 0.19.0 since its now merged) and forgetting won't hurt - we can remove this at any point after its sure to be available upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this is good clean-up.
I also saw this thing where the vmin/vmax lines won't show when I update their values in Spline mode. But again, I cannot reproduce it. 🤷
# NOTE: Index 0 in marks is assumed to be the bin centers. | ||
x = self.stretch_histogram.figure.marks[0].x | ||
y = np.ones_like(x) | ||
|
||
# Copied from the __call__ internals of glue/viewers/image/composite_array.py | ||
data = interval(x) | ||
data = contrast_bias(data, out=data) | ||
data = stretch(data, out=data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can consolidate this with the similar logic for the stretch curve... the stretch curve uses a linspace between vmin/vmax whereas this uses the histogram bins and needs to extend beyond vmin/vmax. (@pllim @bmorris3 - what if we did a linspace between the lower and upper bin and use the same sampling for both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
colorbar needs to render beyond the vertical lines, it needs to span the whole visible histogram. I think the lines can move around, but not the histogram bars. Or am I not understanding how all these stuff is supposed to work together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, let's merge for now since @haticekaratay and @javerbukh both need to build on top of this and we can discuss and do this as follow-up if we think it can be simplified. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for your work!
Description
This pull request:
No changelog entry needed as none of these changes have seen a release yet.
Note: this is expected to have a merge conflict with #2537, but should be fairly simple to address.
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.