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

cubeviz spectral extraction live-previews #2733

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Feb 27, 2024

Description

This pull request implements live-previews for spectral extraction in cubeviz. Since this may become expensive and to mitigate potential lag, this also migrates the functionality to time expensive live-previews and temporarily disable them from lcviz to here as a decorator which is then used in the implementation of live-previews in cubeviz's spectral extraction.

lcviz can then remove its own implementation to make use of this PR in kecnry/lcviz#3

NOTE: this screen recording was done with the timeout lowered to 0.1 seconds to show how the pausing works. In the PR, this value is set to 0.3 and usually does not trigger for the default cube. The "entire cube" does not display any preview because of a known bug where nans in the cube are resulting in a spectrum of entire nans (addressed by #2737).

Screen.Recording.2024-03-01.at.11.28.51.AM.mov

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

Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 93.84615% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 88.88%. Comparing base (0336005) to head (a1c5b44).
Report is 4 commits behind head on main.

Files Patch % Lines
...plugins/spectral_extraction/spectral_extraction.py 95.65% 2 Missing ⚠️
jdaviz/core/template_mixin.py 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2733      +/-   ##
==========================================
+ Coverage   88.67%   88.88%   +0.21%     
==========================================
  Files         108      108              
  Lines       15886    15981      +95     
==========================================
+ Hits        14087    14205     +118     
+ Misses       1799     1776      -23     

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

@kecnry kecnry force-pushed the live-preview-temp-disable branch 2 times, most recently from 64381fb to a311743 Compare February 28, 2024 17:42
@kecnry kecnry force-pushed the live-preview-temp-disable branch from a311743 to cab02e2 Compare February 28, 2024 18:41
@kecnry kecnry changed the title migrate temp disabling live-previews from lcviz cubeviz spectral extraction live-previews Mar 1, 2024
@kecnry kecnry force-pushed the live-preview-temp-disable branch from 95c201f to a1c5b44 Compare March 1, 2024 15:31
@kecnry kecnry marked this pull request as ready for review March 1, 2024 16:30
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.

Seems to work for me (FWIW I do hit the 0.3 second limit with the example cube, my computer must be lazier), I'm going to spend a little more time understanding all the code before approving.

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.

Code looks good. Is there any way to add a test for the timeout? I don't see an easy way to do it since you can't set the timeout in the decorator dynamically/on the fly when calling the function, so you can't just set it to 0 for the test.

@kecnry
Copy link
Member Author

kecnry commented Mar 1, 2024

I guess we could maybe test it with a fake plugin that just sleeps for half a second? 🤷‍♂️ Is that worth doing?

@rosteen
Copy link
Collaborator

rosteen commented Mar 1, 2024

I guess we could maybe test it with a fake plugin that just sleeps for half a second? 🤷‍♂️ Is that worth doing?

if time_to_write_fake_plugin_test < 15 * u.Unit("minutes"):
    return True
else:
    return False

@kecnry kecnry mentioned this pull request Mar 6, 2024
8 tasks
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 it in Cubeviz, and it behaves as described. Thank you for your work.

@kecnry kecnry merged commit c731eef into spacetelescope:main Mar 7, 2024
16 checks passed
@kecnry kecnry deleted the live-preview-temp-disable branch March 7, 2024 17:36
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants