DM-55580: Make mask display faster - #23
Merged
Merged
Conversation
timj
commented
Jul 22, 2026
Member
- There was a imshow call that was not needed because it was immediately followed by imshow.
- We were calling imshow per mask plane and that was not only causing rendering each time but also additional matplotlib overhead. This patch creates a high res composite mask image first and then hands it off to matplotlib once.
erykoff
approved these changes
Jul 22, 2026
erykoff
left a comment
There was a problem hiding this comment.
Are you sure that the draw_idle isn't needed?
Member
Author
|
|
This redraw is not needed because the calling code immediately redraws.
Displaying an Exposure previously drew the mask with one imshow per set bitplane, so a coadd with many populated planes produced a dozen full-resolution overlay layers. Every repaint then colour-mapped and resampled each layer independently, which dominated the display time (the resampling itself is cheap; generating the full-resolution RGBA for each layer is the cost). Blend the visible planes into a single full-resolution RGBA image and draw it as one layer instead. The Porter-Duff "over" operator is associative, so this is equivalent to drawing each plane separately but leaves matplotlib with one layer to colour-map and resample rather than one per plane; rendered output matches the old path to within 8-bit rounding. fastMaskDisplay is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.