Add hacks/make_superbias.py: per-chip superbias / NMAD / bad-pixel mask#1
Merged
Merged
Conversation
…mask
Builds three Rice-compressed FITS per chip from a stack of LS4Cam bias
frames:
superbias_<CCD>.fits.fz float32, MED_BIAS = median of image
superbias_nmad_<CCD>.fits.fz float32, MB_NMAD = median of NMAD image
superbias_mask_<CCD>.fits.fz int16, 1 where NMAD > 3*1.4826*median(NMAD)
Two input layouts via --input-mode:
multi-ext (default): raw multi-extension exposures; runs
LS4Cam.overscan_and_trim internally per chip.
per-chip: flat directory of already-trimmed per-chip files;
groups by CCD_LOC header keyword. Different chips
may have different N.
Both modes have been verified to produce bit-identical superbias / NMAD /
mask outputs on the same underlying frames.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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
Adds a single new script,
hacks/make_superbias.py, that builds three Rice-compressed FITS products per LS4Cam chip from a stack of bias frames:superbias_<CCD>.fits.fzMED_BIASsuperbias_nmad_<CCD>.fits.fzMB_NMADsuperbias_mask_<CCD>.fits.fzNMASKED,MASKTHRTwo input modes
--input-mode multi-ext(default): each input is a multi-extension raw exposure with the bias section still present; the script callsLS4Cam.overscan_and_trimper chip extension internally.--input-mode per-chip: a flat directory of already-trimmed per-chip FITS files, grouped by theCCD_LOCheader keyword. Different chips may have different N. Files lackingCCD_LOCare skipped with a warning.Verified for bit-exact equivalence on a 31-frame test set: per-chip mode and multi-ext mode produce identical superbias, NMAD, and mask images for the same underlying frames.
Real-data shakedown
Run on 31 single-amp LS4Cam bias frames (992 chip-images):
MED_BIASclusters at 0 ± 2.5 ADU on every chip ✅MB_NMADquantizes to {3.71, 4.45, 5.19} (= 1.4826 × {2.5, 3.0, 3.5}) — expected artifact of int16 raw + N=31NW_BandNW_Ctogether account for 48% of all masked pixels — visually confirmed bad columnsTest plan
--input-mode multi-extagainst a directory of LS4Cam multi-ext bias frames; verify 3 outputs per chip and reasonable header values.--input-mode per-chipagainst an already-trimmed per-chip directory; verify same outputs.--chips NE_G NW_Bfilter restricts processing to a subset.ruff check hacks/make_superbias.pyis already green).🤖 Generated with Claude Code