Smartstack: generate preview JPEGs and final e45 products - #474
Draft
timbeccue wants to merge 11 commits into
Draft
Smartstack: generate preview JPEGs and final e45 products#474timbeccue wants to merge 11 commits into
timbeccue wants to merge 11 commits into
Conversation
This was referenced Aug 6, 2026
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.
Summary
This is PR 5 of 8 completing the v1 banzai implementation of Smartstacking at site.
PR1 (#469): combine math
PR2 (#470): JPEG utilities
PR3 (#471): DB updates
PR4 (#473): shipper contract
PR5 (#474): smartstack data products <-- you are here
PR6 (#475): stack worker polling
PR7 (#476): e2e tests, compose cleanup
PR8 (#477): logging
PRs 1–4 provide the independent foundations for combining images, rendering JPEGs, storing stack state, and shipper integration (this PR). This PR brings them together into the product layer:
PR6 will own the lifecycle decisions (stack worker behavior) that call this layer.
Note on merging: this should be merged into main only after PR1-4 are merged. Right now the base is set to simulate that so the diffs are easy to read, but the base should be changed to main before it's actually merged.
What the changes do:
stack_num.e09withe45.The final FITS records aggregate and provenance metadata in both the primary and
SCIheaders, including totalEXPTIME, earliestDATE-OBS,NCOMBINE,MOLUID, and orderedIMCOMnnninputs. It also removes per-exposureMOLFRNUM, scales stack-dependent detector values, and remeasures the combined-image background statistics.Header changes in stacked products:
While most fits headers are copied over from the stackframes, some are recalculated. I think the procedures make sense, but they're definitely worth a close review.
Preview and final paths
run_preview():fits: nulland aggregate thumbnail metadata.run_final():e45FITS and both JPEGs.Scope
The PR-local implementation is
banzai/smartstack_products.pyand its focused tests. The combine, JPEG, database, and publisher layers visible in the cumulative branch are inherited from PR1–4.This PR builds products but does not poll for work or manage lifecycle state. Tests cover output structure, metadata and provenance, stable naming, invalid inputs, preview publication, and a real FITS write/reopen path.