Skip to content

Avoid unnecessary copies in aligned single-component mosaics - #488

Open
timbeccue wants to merge 3 commits into
mainfrom
feature/mosaic-single-component
Open

timbeccue wants to merge 3 commits into
mainfrom
feature/mosaic-single-component

Conversation

@timbeccue

Copy link
Copy Markdown
Contributor

Description

MosaicCreator rebuilds the science, mask, and uncertainty arrays even when a single component already matches the output geometry. For large QHY frames, this adds unnecessary memory copying and temporary-file allocation.

This PR adds a shortcut for single-component images that already match the output geometry. It reuses existing arrays while keeping the same header updates, uncertainty precision, and memory-map behavior in later stages.

The shortcut is used for inputs with native float64 science data, uint8 masks, and writable, contiguous arrays. All other inputs use the existing mosaic code.

Validation

  • 438 unit tests passed, with five end-to-end tests excluded.
  • Regression coverage includes array and header equivalence, allocation counts, separate primary headers, binned windows, cropping, flipping, dtype handling, and read-only or strided inputs.
  • A single local synthetic full-frame benchmark with float64 uncertainties decreased from 2.85 s to 0.076 s, with matching output arrays and headers.

@timbeccue
timbeccue requested review from cmccully and drhaz September 15, 2026 23:22

This branch has not been deployed

No deployments
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.

1 participant