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

helper and viewer-level access to data_labels properties #2626

Merged
merged 3 commits into from
Dec 22, 2023

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Dec 18, 2023

Description

This pull request implements viz.data_labels, viz.viewers[...].data_labels_loaded, and viz.viewers[...].data_labels_visible which are each a read-only list. This is intended to provide an alternative to suggesting users access viz.app.data_collection to inspect the list of data labels eligible to be passed to viz.get_data(), etc.

In the future, viz.viewer[...].data_labels as a list of all data entries supported by a specific viewer (those loaded as well as those in the expanded data menu) would be convenient, but currently all that logic lives in vue, not python.

See spacetelescope/jdat_notebooks#203 for how this would allow us to remove non-public API from public-facing notebook examples.

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)?

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

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

Comparison is base (8128788) 91.53% compared to head (8a9dfdf) 91.52%.
Report is 10 commits behind head on main.

Files Patch % Lines
jdaviz/core/template_mixin.py 69.23% 4 Missing ⚠️
jdaviz/configs/default/plugins/viewers.py 86.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2626      +/-   ##
==========================================
- Coverage   91.53%   91.52%   -0.01%     
==========================================
  Files         161      161              
  Lines       19944    19983      +39     
==========================================
+ Hits        18256    18290      +34     
- Misses       1688     1693       +5     

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

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.

Philosophical questions posted, as you requested. 🧐

CHANGES.rst Outdated Show resolved Hide resolved
@@ -36,25 +36,55 @@ def __init__(self, *args, **kwargs):
@property
def user_api(self):
# default exposed user APIs. Can override this method in any particular viewer.
expose = ['data_labels', 'data_labels_loaded', 'data_labels_visible']
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm...

  1. Does this include Mosviz table viewer? Do we want to expose these for Mosviz?
  2. How do you want the Imviz fake WCS layers to behave for this? Are they not exposed here even though people can see them in the Data drop down?
  3. I am guessing for Cubeviz case, the spectrum viewer will say it has no data labels even though a spectrum is visible because of the collapse magic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Does this include Mosviz table viewer? Do we want to expose these for Mosviz?

Good point, I'll exclude from the user-API for table viewers

How do you want the Imviz fake WCS layers to behave for this? Are they not exposed here even though people can see them in the Data drop down?

Good question, they will show up here , and maybe we will want to exclude them. If that's what we want, I can do a follow-up PR to the image rotation PR once its rebased on this or merged into main.

I am guessing for Cubeviz case, the spectrum viewer will say it has no data labels even though a spectrum is visible because of the collapse magic?

No, the spectrum should still show up as it is a data layer loaded into that viewer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Excluded now from mosviz, and confirmed that the cube shows up as expected in the spectrum viewer (and matching the UI as of #2631).

I also cross linked back here from the image rotation PR so that we can consider your second question then.

@kecnry kecnry marked this pull request as ready for review December 21, 2023 18:35
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!

Copy link
Contributor

@haticekaratay haticekaratay left a comment

Choose a reason for hiding this comment

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

I tested the implementation in Imviz and confirmed that it performs as expected. Thanks for your work!

@pllim pllim merged commit 8b997fb into spacetelescope:main Dec 22, 2023
16 of 19 checks passed
@kecnry kecnry deleted the api-data-labels branch January 4, 2024 14:33
# 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.

3 participants