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 cube extract #2939

Merged
merged 23 commits into from
Jul 30, 2024

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Jul 8, 2024

Description

This pull request generalizes cubeviz's spectral extraction so that it can be re-used by lcviz (photometric extraction of target pixel files) and eventually rampviz. This is milestoned for the 4.0 release, which already contains breaking changes to spectral extraction.

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. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@kecnry kecnry added this to the 4.0 milestone Jul 8, 2024
@github-actions github-actions bot added cubeviz imviz plugin Label for plugins common to multiple configurations labels Jul 8, 2024
@kecnry kecnry added the no-changelog-entry-needed changelog bot directive label Jul 8, 2024
@kecnry kecnry force-pushed the lcviz-generalize-cube-extract branch 2 times, most recently from 14a099d to 1d4c6af Compare July 8, 2024 14:23
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 94.71366% with 12 lines in your changes missing coverage. Please review.

Project coverage is 88.92%. Comparing base (3de1b08) to head (620a102).
Report is 150 commits behind head on main.

Files with missing lines Patch % Lines
jdaviz/configs/cubeviz/plugins/mixins.py 89.28% 9 Missing ⚠️
...plugins/spectral_extraction/spectral_extraction.py 97.67% 2 Missing ⚠️
jdaviz/core/template_mixin.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2939      +/-   ##
==========================================
+ Coverage   88.91%   88.92%   +0.01%     
==========================================
  Files         111      112       +1     
  Lines       17365    17396      +31     
==========================================
+ Hits        15440    15470      +30     
- Misses       1925     1926       +1     

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

@kecnry kecnry force-pushed the lcviz-generalize-cube-extract branch 2 times, most recently from 41df811 to 8a3fc8f Compare July 8, 2024 18:00
@kecnry kecnry marked this pull request as ready for review July 8, 2024 18:20
@kecnry kecnry force-pushed the lcviz-generalize-cube-extract branch 3 times, most recently from 6fce0b0 to ebbed5d Compare July 10, 2024 18:23
Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

One minor suggestion about some disabled message text, but other than that I think this looks good - less complicated that the diff suggested, mostly just moving things around and renaming.

@kecnry kecnry force-pushed the lcviz-generalize-cube-extract branch from ffa282b to b5a2734 Compare July 11, 2024 12:44
Copy link
Contributor

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

Some superficial comments for readability.

@kecnry kecnry marked this pull request as draft July 12, 2024 17:38
@kecnry kecnry force-pushed the lcviz-generalize-cube-extract branch 2 times, most recently from e2de7c0 to c773c2c Compare July 12, 2024 19:36
@kecnry
Copy link
Member Author

kecnry commented Jul 12, 2024

@bmorris3 / @rosteen - added a few more commits since your last reviews if you want to re-review (should be able to filter the diff to just the last ~6 commits)

@bmorris3 - addressed your comments. I haven't touched renaming background or wavelength-dependent related methods and attributes that don't need to be used for lcviz (wavelength_dependent, bg_wavelength_dependent, bg_spec_per_spaxel, bg_spec_add_results, extract_bg_spectrum) - but will rampviz need access to these and maybe we should generalize them (either here or as a separate effort before they get released in 4.0)?

@rosteen
Copy link
Collaborator

rosteen commented Jul 25, 2024

I think it looks ok, my approval can stand.

kecnry added 23 commits July 30, 2024 08:18
* instead of relying on a spectrum viewer existing and being set
* (temporarily to just the first instance, later we'll make this more flexible to allow any number of slice indicator viewers)
to ensure that the preview marks are always visible when first opening
* preview on first plugin open is still not correct, but was not on main either
@kecnry kecnry force-pushed the lcviz-generalize-cube-extract branch from dadd893 to 620a102 Compare July 30, 2024 12:20
Copy link
Contributor

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

Thanks @kecnry, looks good 👌🏻

spectral_display_unit, reference_spectral_value=None):
slice_display_unit, spatial_axes=(0, 1), reference_spectral_value=None):
# slice_axis is the remaining axis (of (0, 1, 2)) not included in spatial_axes
slice_axis = 3 - sum(spatial_axes)
Copy link
Contributor

Choose a reason for hiding this comment

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

I've tested it, and of course it is less performant – but it's the difference between 40 nanoseconds for the original and 150 ns for my suggestion. I'm not sure anyone will notice. 😉

@kecnry kecnry merged commit 682e302 into spacetelescope:main Jul 30, 2024
19 checks passed
@kecnry kecnry deleted the lcviz-generalize-cube-extract branch July 30, 2024 14:11
@kecnry kecnry mentioned this pull request Aug 29, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cubeviz imviz no-changelog-entry-needed changelog bot directive 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