-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
move redshift slider to line list plugin #1031
Conversation
* and redesign slider to fix roundtripping and work with showing both RV and redshift simultaneously
ff41211
to
649afb4
Compare
* replaces lower/upper with range (API change) * range/step can both take 'auto' (default) in which case they're set (and updated) based on x-limits of spectrum-viewer (so that the slider can move a line from the middle to either edge of the plot limits, with 100 discrete steps)
649afb4
to
7dad233
Compare
* msg on subset selection was being sent but raising an error (in the output widget only....) that msg.data was None
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1031 +/- ##
==========================================
+ Coverage 73.23% 73.70% +0.46%
==========================================
Files 75 74 -1
Lines 5657 5620 -37
==========================================
- Hits 4143 4142 -1
+ Misses 1514 1478 -36 ☔ View full report in Codecov by Sentry. |
* move most UI information into the Line List plugin * keep notebook access in the independent redshift page
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, good work thus far! Some comments below:
- While 42 is the answer for everything, setting the limits to +/-0.42 does seem pretty arbitrary. Why not +/-0.5?
- When I start at redshift=0 and I drag the slider all the way to -0.42, the final redshift does not end up being -0.42. I guess I'll wait for your documentation updates to see if this is expected or not.
- What is the status of round-tripping fix? When I copy paste the RV value at redshift=0.1 from the plugin, change the redshift to another value, and then paste that RV value back, the redshift displayed ends up being 0.10000000000000009. Is this expected?
- When I manually enter the redshift value, there is a noticeable lag for RV to update. I don't know if fixing this lag is out of scope or not. I have the Specviz example loaded and SDSS lines plotted.
- It is nice that blueshift is naturally supported now. 👍
RTD failure is real. |
The limits of the delta-redshift slider default to a rough estimate of the redshift needed to move a line across the x-limits of the spectrum viewer... 0.42 is just a happy accident here. See the
I cannot reproduce (it does go to -0.42 for me, although to +0.42 does show a precision issue at 0.420000001). Can you show a screenrecording? Regarding the precision "issue", I could always round the shown value to a number of decimal points, but I think that could have unexpected consequences and would need to be thought out carefully.
That's a good point, the roundtripping is only actually fixed with respect to the UI (i.e. you enter a redshift and that redshift is preserved and not slightly changed by internal recursive logic), but the actual equations in
Most of the lag is caused by replotting the lines and was a known "issue" (hopefully its almost immediate for a handful of lines), I have a plan to optimize this, but it's probably out of scope here and will be easier after #1013 is merged to avoid conflicts. |
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
ca3a98c
to
20204d1
Compare
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
7d258f5
to
86cb3a9
Compare
hopefully the cause of RTD complaining about the NEXT hyperlink...
Should that be documented, if not already? |
I haven't looked into the code yet, but the first thing I noticed in testing is that this performs significantly worse than the slider on Screen.Recording.2022-01-07.at.1.10.47.PM.movScreen.Recording.2022-01-07.at.1.12.56.PM.mov |
@pllim - that can never hurt, any suggestions where it best belongs?
@rosteen - I tried a few things which seem to help, but I can't reproduce quite as noticeable of a difference on my end. I do have ideas to optimize the line drawing (so that we scale better with Nlines but also to have the throttle timeout some function of the number of lines to prevent cases where the drawing lags steps behind), but those will be much easier to handle once this and #1013 are both merged. I agree that any up-front overhead that doesn't scale with Nlines should be minimized as much as possible here, though, to at least achieve roughly the same responsiveness as before. |
* optimizes slider responsiveness
* avoids a float cast on every slider move
* needed for new lines to immediately adopt the current redshift * redundancy between self.rs_redshift and _global_redshift seems to exist for future flexibility of allowing multiple redshifts - but if that is ever abandoned, we should merge and replace all instance of _global_redshift with rs_redshift
43b291d
to
11b9194
Compare
What about a new entry under https://github.com/spacetelescope/jdaviz/blob/main/docs/known_bugs.rst ? |
else: | ||
raise NotImplementedError(f"RedshiftMessage with param {param} not implemented.") | ||
|
||
def _velocity_to_redshift(self, velocity): |
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.
See astropy/astropy#12709 . Maybe after astropy
5.1 is out, we can use that instead...
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.
sure! Although dropping unit conversion did help with some overhead since this is called on every slider update, so we will need to consider any time cost (which we'll need to do anyways if we want to support reading/setting RVs in other units)
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.
Re: performance -- Is it possible to only convert the value when mouse release is detected on the slider (i.e., user stops sliding)?
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.
yes, that's an option, but I think its nice to see the RV updating live. (Note: we're no longer worried about performance as-is and have a working version outside this PR which will drastically improve lagginess).
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 this conversion is not a true bottleneck for performance, might be better to use what is in astropy when that is available. That way, you know that functionality is vigorously tested upstream and it would natively support Quantity, so you can remove the comment about "if supporting non-km/s units in the future". Something to think about.
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 just pushed a few minor code changes (use isinstance
instead of type() ==
in the line code, and a more detailed docstring). Everything else looks good to me, since there will be a performance PR to follow this up.
Should we reserve a second approval from PO? |
I think that will be more relevant for the performance PR? We've already at least had verbal approval of this during meetings, I'm ok merging it with only dev approvals here. |
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.
Just nitpick on the code, otherwise LGTM but I want to withhold approval until I know I am looking at the final version of this PR, given the last TODO box is still unchecked, as per Slack discussion on 2022-01-11.
else: | ||
raise NotImplementedError(f"RedshiftMessage with param {param} not implemented.") | ||
|
||
def _velocity_to_redshift(self, velocity): |
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 this conversion is not a true bottleneck for performance, might be better to use what is in astropy when that is available. That way, you know that functionality is vigorously tested upstream and it would natively support Quantity, so you can remove the comment about "if supporting non-km/s units in the future". Something to think about.
3121431
to
889e2d4
Compare
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
977331c
to
0a66924
Compare
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.
Description
This pull request moves the redshift slider to the line list plugin (in the plugin tray), which allows viewing the redshift and RV simultaneously as well allowing a redesign of the slider functionality (which now acts as a delta-redshift slider) to fix the roundtripping issues seen in #987. This affects both specviz and mosviz (by removing the slider from the toolbar), and also adds redshift support to cubeviz.
API CHANGE: this also changes
specviz.set_redshift_slider_bounds(lower, upper, step)
tospecviz.set_redshift_slider_bounds(range, step)
and adds support for passing'auto'
to eitherrange
orstep
to then keep in sync with spectrum-viewer x-limits.automatic slider limits (can be overridden with API, styling slightly out-of-date from screenshot above):
Screen.Recording.2022-01-06.at.4.30.06.PM.mov
TODO
FUTURE IDEAS (not necessarily in this PR)
mouseup
event is getting blocked from bubbling up which I also ran into in Proof of concept: transparent menu while interacting with sliders #1021?Fixes #987, fixes #473
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.CHANGES.rst
?