Skip to content
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

Interactive line identification #1115

Merged
merged 28 commits into from
Mar 22, 2022
Merged

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Feb 24, 2022

Description

This pull request implements interactive support to help identify lines in line lists by highlighting a selected line, a new tool (needs an icon) to click to select a line, as well as the ability to assign a redshift based on the centroid returned by the line analysis plugin and the selected line.

This UX-pattern (ability to "lock" a dropdown with the selected item in the plot) could be extended in the future for subsets.

NOTE: icons have been updated since the following recording (see screenshot following) and the tool has been moved into the nested toolbar (available in the submenu for the slice indicator in cubeviz), but behavior has not changed.

Screen.Recording.2022-02-24.at.1.31.53.PM.mov

Updated with custom icon:

Screen Shot 2022-03-02 at 2 51 44 PM

TODO:

  • new icon for tool (and possibly for "selected" icon in the sidebar?). @Jenneh
  • changes entry
  • docs updates?
  • test coverage

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.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a change log needed? If yes, is it added to CHANGES.rst?
  • Is a milestone set? Milestone is only currently required for PRs related to Imviz MVP.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@kecnry kecnry added this to the 2.3 milestone Feb 24, 2022
@codecov
Copy link

codecov bot commented Feb 25, 2022

Codecov Report

Merging #1115 (034c9ba) into main (be1d987) will increase coverage by 0.47%.
The diff coverage is 87.44%.

@@            Coverage Diff             @@
##             main    #1115      +/-   ##
==========================================
+ Coverage   76.37%   76.85%   +0.47%     
==========================================
  Files          87       87              
  Lines        6723     6935     +212     
==========================================
+ Hits         5135     5330     +195     
- Misses       1588     1605      +17     
Impacted Files Coverage Δ
jdaviz/configs/cubeviz/plugins/tools.py 73.33% <ø> (ø)
jdaviz/configs/cubeviz/plugins/viewers.py 97.56% <ø> (-0.06%) ⬇️
jdaviz/core/tools.py 75.00% <72.41%> (-1.05%) ⬇️
...igs/specviz/plugins/line_analysis/line_analysis.py 79.90% <83.63%> (+1.09%) ⬆️
...z/configs/default/plugins/line_lists/line_lists.py 65.66% <89.28%> (+6.61%) ⬆️
jdaviz/core/marks.py 78.39% <93.33%> (+2.04%) ⬆️
jdaviz/components/toolbar_nested.py 73.21% <100.00%> (+0.99%) ⬆️
jdaviz/configs/specviz/plugins/viewers.py 68.32% <100.00%> (+2.72%) ⬆️
jdaviz/core/events.py 91.05% <100.00%> (+0.87%) ⬆️
jdaviz/app.py 90.24% <0.00%> (-0.05%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be1d987...034c9ba. Read the comment docs.

@kecnry kecnry force-pushed the line-identify branch 2 times, most recently from 524ff5e to 235544f Compare February 28, 2022 16:10
@rosteen rosteen modified the milestones: 2.3, 2.4 Mar 2, 2022
@kecnry kecnry mentioned this pull request Mar 3, 2022
28 tasks
@kecnry kecnry mentioned this pull request Mar 11, 2022
9 tasks
@kecnry kecnry force-pushed the line-identify branch 6 times, most recently from a9322ee to c731e21 Compare March 14, 2022 19:22
jdaviz/configs/cubeviz/plugins/viewers.py Outdated Show resolved Hide resolved
Comment on lines -55 to -57
lt['redshift'] = u.Quantity(0.046)
with pytest.warns(UserWarning, match='per line/list redshifts not supported, use viz.set_redshift'): # noqa
specviz_helper.load_line_list(lt)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already covered in test_redshift test, no sense in repeating it here.

jdaviz/configs/specviz/plugins/viewers.py Outdated Show resolved Hide resolved
@kecnry kecnry marked this pull request as ready for review March 14, 2022 19:34
# update the RV and all other obs wavelengths. Once tabbing or losing focus, vue will
# send another event with avoid_feedback=False so that the wavelength updates to
# exactly match the redshift (so that can be considered the ground truth value consistently)
if kwargs.get('avoid_feedback', False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe store kwargs.get('avoid_feedback', False) in a var, since it is called again below?

kecnry added 6 commits March 18, 2022 12:37
* and start work on some optimizing based on plugin being opened.... still need to try to only updated obs values if the accordion for that list is opened.
* was resulting in a feedback loop between the two instances causing laggy drag as well as confusion between SelectSlice and SelectLine
@kecnry
Copy link
Member Author

kecnry commented Mar 18, 2022

I do not necessarily also want slice indicator to move around when I click on the line to see what line it is. It is a little confusing to have this new button to also be that other button, you know what I mean?

This was caused because the nested toolbar in #1140 was initialized twice for cubeviz's spectrum-viewer and there was a feedback loop between the two instances (which also resulted in very laggy dragging of the slice indicator... if for some reason the fix in this PR does not make the next release, this should probably be split out as a separate quick bugfix).

What about a read-only text field within Line Profile? Kinda like Compass? Like Selected: None or Selected: S II.

That's a good idea, added. Clicking the label is now also a quick way to clear the selection.

@kecnry kecnry marked this pull request as ready for review March 18, 2022 17:04
@kecnry
Copy link
Member Author

kecnry commented Mar 18, 2022

Looks like test failure is the same as #1178 (comment) and can likely be ignored.

@rosteen
Copy link
Collaborator

rosteen commented Mar 18, 2022

A few comments based on my testing:

  1. The very first thing I noticed on starting to test this, is that I dislike the spectral line tool being pre-selected as the default tool when you start Specviz. In Cubeviz it makes sense to have the slicer be default since it's immediately useful, but having a tool selected by default when it doesn't do anything unless there are lines loaded feels weird.

  2. Clicking the "identify line" icon in the line list menu causes the entries all to move slightly, which is somewhat annoying:

Screen.Recording.2022-03-18.at.1.44.03.PM.mov
  1. A minor quality of life improvement could be scrolling the line list plugin to the selected line if you click on the line in the viewer, if you already have the plugin open. This would help when there's a list loaded with lots of lines (e.g. most of the preset line lists). I would be fine with this being a future improvement, since it seems like it might be complicated to implement.

I really like the redshift from centroid feature, it feels great to have the line lists more seamlessly integrated into other line-related functionality.

@kecnry
Copy link
Member Author

kecnry commented Mar 18, 2022

@rosteen - I tried to address two of your comments (scrolling unfortunately isn't feasible), let me know what you think! I was trying to keep the behavior consistent so that it would always default to whatever was in that 4th menu entry, but I can see for now how that probably isn't ideal in the case of specviz. Down the road it might even be nice to hide tools that aren't usable (hide line selection until there are lines, etc), and then it might make more sense to re-enable that behavior.

kecnry added 2 commits March 21, 2022 08:50
to avoid shifting in the plugin, but also to provide tooltips with help text
* results_centroid is now an internal trait which is observed to avoid multiple manual calls to updating the redshift value.  This should ensure its always kept up to date.
@rosteen
Copy link
Collaborator

rosteen commented Mar 21, 2022

Looks good to me now, thanks! I'm excited to get this in, it feels like it really bumps up the usefulness of the line lists by an order of magnitude.

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great! No lag when loading all SDSS lines in Specviz but some lag in Cubeviz, but I don't think fixing that is in scope here.

Just one more minor question: I notice that this identify button is stacked with slice in Cubeviz, but it is standalone in Specviz. If that is intentional, then this is good to go!

Copy link
Contributor

@PatrickOgle PatrickOgle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very useful tool for identifying a single line and assigning a redshift. We should contemplate generalizing this to multiple lines in a future PR.

@kecnry kecnry merged commit 1b49d2f into spacetelescope:main Mar 22, 2022
@kecnry kecnry deleted the line-identify branch March 22, 2022 14:26
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants