Skip to content

Stop last-ramp science FITS from following the live CDS/Fowler combo - #56

Draft
cursor[bot] wants to merge 1 commit into
feature/h2rg-debugfrom
cursor/critical-bug-management-b09f
Draft

Stop last-ramp science FITS from following the live CDS/Fowler combo#56
cursor[bot] wants to merge 1 commit into
feature/h2rg-debugfrom
cursor/critical-bug-management-b09f

Conversation

@cursor

@cursor cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Bug and impact

After Acquire returns, the GUI is re-enabled so the operator can inspect the last frame. The last ramp's science FITS reused that display image, which is reduced with the live CDS/Fowler combo. The header still received the acquire-time snapshot (DETMODE=CDS, etc.).

If the operator switches CDS ↔ Fowler (or changes Fowler pairs) during "finishing FITS…" — easy on a slow SMB copy of a full-frame cube — the archived *_science.fits for that ramp has the wrong pixels with the wrong-looking header. Other ramps in the same sequence were already reduced from disk with the snapshot; only the last file was wrong.

Root cause

_finish_acquire_archive special-cased the preview ramp:

  • load via _load_fits_from_path_store_raw_fitsself._selected_ramp_mode() (live combo)
  • _save_science_fits(frame, …, reduction=params["ramp_mode"]) wrote those pixels but stamped the snapshot on the header

PR #54 snapshotted mode for later ramps and for DETMODE cards; it did not stop the last ramp from reusing the live-reduced display frame.

Fix

  • Re-reduce the displayed last frame from the raw cube with science_image_for_archive (acquire-time params).
  • Write every science FITS via _save_science_fits_from_ramp so disk products always use the snapshot.

Validation

  • test_last_ramp_science_uses_snapshot_not_live_combo: same cube, live Fowler vs archive CDS, images differ and archive is last-minus-first.
  • python3 -m unittest for test_h2rg_fits_helpers, test_ramp_plan, test_background_nseq, test_fits_science_load, test_fits_header_meta — 90 tests OK.
Open in Web View Automation 

The GUI is re-enabled when ZMQ acquire returns, so the operator can switch
mode before the archive finishes. The last ramp reused that display frame
while stamping the acquire-time DETMODE, so science FITS could be Fowler
pixels labeled as CDS (or the reverse). Re-reduce from the raw cube and
write every science product from disk with the snapshot.

Co-authored-by: Denis Defrère <ddefrere@users.noreply.github.com>
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