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

Generalize units in slice plugin #2706

Merged
merged 13 commits into from
Feb 16, 2024
Merged

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Feb 14, 2024

Description

This pull request generalizes the slice plugin for:

  • future support for display units in cubeviz (needing to alternate between wavelength and frequency)
  • downstream use in lcviz

It does so by:

  • replacing (with deprecation) any user-exposed mention of "wavelength" with either "value" (in the API) or a dynamic string ("wavelength", "frequency", "time", etc)
  • allowing for dynamic units in the plugin UI
  • allowing overriding the plugin header text when inherited by downstream apps (moved to allow downstream apps or config-specific override to docs description #2709)
  • refactoring so setting the slice can be overridden downstream (in cases where it isn't the last index as-is in cubeviz)
  • removing "(spectral axis)" from the tooltip description for the slice viewer tool
  • slice indicator tool sets value via message (generalized with value instead of wavelength) instead of assuming the helper has select_wavelength.
  • moving slice_indicator property to a mixin so that it can be used by other viewers that are not spectral.

Coming as a follow-up PR:

  • breaking the assumption of a single cube with a shape the same as the length of the 1d data (spectrum).

Before PR:

Screen Shot 2024-02-14 at 1 45 01 PM

After PR:

Screen Shot 2024-02-14 at 1 44 27 PM

Change log entry

  • Is a change log needed? If yes, is it added to 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, maintainer
    should 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.

  • 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 milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@kecnry kecnry added this to the 3.9 milestone Feb 14, 2024
@github-actions github-actions bot added cubeviz imviz plugin Label for plugins common to multiple configurations labels Feb 14, 2024
* in prep for unit conversion (where spectral axis can be in frequency instead of wavelength) and for downstream use (ie lcviz)
and instead use a mixin to create and access the slice indicator
@kecnry kecnry changed the title Generalize slice plugin Generalize units in slice plugin Feb 14, 2024
@kecnry kecnry marked this pull request as ready for review February 14, 2024 19:35
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (fb3cf40) 90.82% compared to head (5711319) 90.79%.
Report is 5 commits behind head on main.

Files Patch % Lines
jdaviz/configs/cubeviz/plugins/slice/slice.py 86.66% 6 Missing ⚠️
jdaviz/configs/cubeviz/plugins/tools.py 60.00% 2 Missing ⚠️
jdaviz/core/marks.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2706      +/-   ##
==========================================
- Coverage   90.82%   90.79%   -0.03%     
==========================================
  Files         163      164       +1     
  Lines       21503    21592      +89     
==========================================
+ Hits        19530    19605      +75     
- Misses       1973     1987      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1,6 +1,6 @@
<template>
<j-tray-plugin
description='Select slice (or wavelength) of the cube to show in the image viewers and highlighted in the spectrum viewer. The slice can also be changed interactively in the spectrum viewer by activating the slice tool.'
:description="docs_description || 'Select slice of the cube to show in the image viewers. The slice can also be changed interactively in the spectrum viewer by activating the slice tool.'"
Copy link
Contributor

@pllim pllim Feb 15, 2024

Choose a reason for hiding this comment

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

This (docs_description) doesn't seem related?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is, it's covered in the bullet "allowing overriding the plugin header text when inherited by downstream apps" and coupled with setting docs_description as an empty traitlet in the plugin template mixin.

Copy link
Member Author

Choose a reason for hiding this comment

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

would you rather I split this into a separate PR (and then add the hookups for all the plugins there)?

Copy link
Member Author

Choose a reason for hiding this comment

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

moved (and applied to all plugins) in #2709

hint="Show slice wavelength in label to right of indicator."
v-model="show_wavelength"
label="Show Value"
:hint="'Show slice '+value_label.toLowerCase()+' in label to right of indicator.'"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the need for toLowerCase here.

Copy link
Member Author

@kecnry kecnry Feb 15, 2024

Choose a reason for hiding this comment

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

Because we want lower case here (not "Show slice Wavelength in label..."), but we want title case in the actual input widget, without defining two different strings on the python-side.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, just to make sure, this does not affect string representation of the unit, right? Because "MJy" is not the same as "mjy".

Copy link
Member Author

@kecnry kecnry Feb 15, 2024

Choose a reason for hiding this comment

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

right, this is the label (Wavelength, Frequency, Time, etc), not the unit.

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.

In principle, looks fine. Just a couple of minor comments above.

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.

LGTM. Thanks for the clarifications!

will be covered across all plugins in a separate PR
Copy link
Contributor

@gibsongreen gibsongreen left a comment

Choose a reason for hiding this comment

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

Very useful for myself to see both for immediate implementation and long term planning. I am excited to see the follow-up PR(s)!

@kecnry kecnry merged commit 07de883 into spacetelescope:main Feb 16, 2024
18 of 19 checks passed
@kecnry kecnry deleted the generalize-slice branch February 16, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API change cubeviz imviz plugin Label for plugins common to multiple configurations Ready for final review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants