Skip to content

slicecamd: display L and R at one level (subtract each camera's sky level) - #512

Open
cfremling wants to merge 1 commit into
mainfrom
fix/slicecam-display-sky-level
Open

cfremling wants to merge 1 commit into
mainfrom
fix/slicecam-display-sky-level

Conversation

@cfremling

Copy link
Copy Markdown
Collaborator

The L and R slicecam images sit at different sky levels, so ds9 needs a different scale and stretch for each to show background detail. Slicecam::FITS_file::write_image() now subtracts each camera's sky level from the copy it writes to the file and records it as BGSUB (raw = data + BGSUB). The camera buffer that fine acquisition and auto-exposure read is not changed; frames kept with saveframes are copies of the file.

The sky level uses no geometry, because the lit area moves with slit width, slit offset and binning (DATASEC does not follow it): lit pixels are those above halfway between the 5th and 90th percentiles of the image, and the level is their 3-sigma clipped median (sigma from the MAD). On 13 archived frames (binning 1 and 4, slit 0.36-1.5", offset ±3", 0.1-6 s; night, twilight and day) it is within 0.55 sigma of the histogram mode of the lit sky in both cameras, and an injected saturated star moves it by less than 1 sigma until the star covers ~10% of the frame.

Rebuild, restart slicecamd. Tested on sky using branch cf/summit-20261030 on 2026-11-03.

Jira: PAL-134.

🤖 Generated with Claude Code

…slicecam image

The L and R slicecam images sit at different sky levels, so ds9 needs a
different scale and stretch for each to show background detail.
write_image() now subtracts each camera's sky level from the copy it writes
to the file, so both display at the same level with one scale, and records
the value as BGSUB (raw = data + BGSUB). The camera buffer that fine
acquisition and auto-exposure read is not changed. Frames kept with
saveframes are copies of the file.

No geometry is used, because the lit area moves with slit width, slit
offset and binning (DATASEC does not follow it). Lit pixels are those above
halfway between the 5th and 90th percentiles of the image, and the sky level
is their 3-sigma clipped median (sigma from the MAD). On 13 archived frames
(binning 1 and 4, slit 0.36-1.5", offset +-3", 0.1-6 s; night, twilight and
day) it is within 0.55 sigma of the histogram mode of the lit sky in both
cameras, and an injected saturated star moves it by less than 1 sigma until
the star covers ~10% of the frame. It needs the lit area to cover more than
10% of the frame (17-49% in those frames).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-05T18:57:06.056411Z
We couldn’t complete this review. Comment @codex review to try again.
6e8959e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

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.

3 participants