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

flatten/binning: handle slow live-updates for large data #56

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Nov 9, 2023

This PR introduces a check on the time that the live-updates take, and if exceeding a certain threshold, temporarily disables the live-preview updates and shows an alert prompting to either manually update the live-preview or disable the live-preview marks.

This also makes use of a change upstream in jdaviz to show a spinner in the "apply" buttons when the plugin is computing which temporarily disables clicking the button. For cases where binning/flattening is slow to run, this gives immediate feedback that the button was clicked and doesn't need to be clicked again. This doesn't need to be blocked by pinning a new release of jdaviz, but should make sure that PR gets merged first.

The code here can be simplified slightly by using the @with_spinner() decorator from spacetelescope/jdaviz#2560, but that can be a follow-up once that is in a jdaviz release.

Note: this video was before some style changes in spacetelescope/jdaviz#2560 - the check marks are now gone and will show a spinner, if running on jdaviz main. If not running on main, the "bin" button will not react, but everything else will still work.

Screen.Recording.2023-11-10.at.12.35.36.PM.mov

* raise a warning alert in the plugin telling the user the live-previews aren't updating and prompt them to manually update the preview or to disable the preview markers
* doesn't require upstream PR, but won't have any affect without it
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

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

Files Coverage Δ
lcviz/events.py 100.00% <100.00%> (ø)
lcviz/helper.py 100.00% <ø> (+2.85%) ⬆️
lcviz/plugins/coords_info/coords_info.py 95.04% <100.00%> (ø)
lcviz/plugins/ephemeris/ephemeris.py 94.57% <100.00%> (ø)
lcviz/template_mixin.py 84.44% <100.00%> (-1.84%) ⬇️
lcviz/plugins/binning/binning.py 95.26% <85.71%> (-0.89%) ⬇️
lcviz/plugins/flatten/flatten.py 96.32% <84.61%> (-1.26%) ⬇️

📢 Thoughts on this report? Let us know!

@kecnry kecnry marked this pull request as ready for review November 10, 2023 17:36
@kecnry kecnry requested a review from bmorris3 November 10, 2023 18:17
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.

Looks good, works for me. One small revision requested, but not required.

@@ -189,6 +200,10 @@ def _live_update(self, event={}):
mark.times = []
mark.update_xy(times, lc.flux.value)

self.last_live_time = np.round(time() - start, 2)
if self.last_live_time > 0.3:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the threshold a traitlet, and expose it in the user API? It'd be great if a user could assert: "I'm sick of that warning, I'll gladly wait, leave me alone." The user could set the number to 10_000, get coffee, and come back without a warning.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like this idea, but even though we aren't technically committing to API yet, we might soon, and I think it might make sense to play with it and converge more on the feature (if necessary) before we make it customizable.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy with that. 👍🏻

@kecnry kecnry merged commit 989e282 into spacetelescope:main Nov 27, 2023
7 of 9 checks passed
@kecnry kecnry deleted the better-large-data branch November 27, 2023 17:51
bmorris3 pushed a commit to bmorris3/lcviz that referenced this pull request Dec 8, 2023
…ope#56)

* flatten: disable live-updating when slow

* raise a warning alert in the plugin telling the user the live-previews aren't updating and prompt them to manually update the preview or to disable the preview markers

* binning: disable live-updating when slow

* make use of action_spinner

* doesn't require upstream PR, but won't have any affect without it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants