Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TSNR value when cframe mask or ivar=0 #2341

Merged
merged 3 commits into from
Aug 23, 2024
Merged

Fix TSNR value when cframe mask or ivar=0 #2341

merged 3 commits into from
Aug 23, 2024

Conversation

julienguy
Copy link
Contributor

This PR fixes 2 issues in TSNR calculation:

  • avoid situations where we apply a correction based on a ratio of 2 small numbers for fibers that are off target (and have a low TSNR anyway).
  • use the cframe.mask==0 and cframe.ivar>0 instead of frame.mask==0 and frame.ivar>0 in the computation of TSNR because some spectal values are masked during calibration.

@julienguy
Copy link
Contributor Author

Validation example:

desi_process_exposure --infile /global/cfs/cdirs/desi/spectro/redux/jura/exposures/20231206/00208376/frame-r2-00208376.fits.gz --fiberflat /global/cfs/cdirs/desi/spectro/redux/jura/exposures/20231206/00208376/fiberflatexp-r2-00208376.fits.gz --sky /global/cfs/cdirs/desi/spectro/redux/jura/exposures/20231206/00208376/sky-r2-00208376.fits.gz --calib /global/cfs/cdirs/desi/spectro/redux/jura/exposures/20231206/00208376/fluxcalib-r2-00208376.fits.gz --outfile cframe-r2-00208376-new.fits.gz --cosmics-nsig 6

Two fibers that had large TSNR now have TSNR values=0 (because masked), the others are unchanged.

@sbailey
Copy link
Contributor

sbailey commented Aug 23, 2024

Thanks. I double checked this case for main vs. this PR and confirm that 2 fibers that are very offset and completely masked now have TSNR2=0 instead of a crazy large value, and 4 other fibers have a very small decrease in TSNR2 which we interpret as being because cframes have slightly more masked pixels than frames (e.g. due to fiberflats or fluxcalib having masked pixels).

@sbailey sbailey merged commit 6796c59 into main Aug 23, 2024
26 checks passed
@sbailey sbailey deleted the tsnr-of-bad-fibers branch August 23, 2024 23:08
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.

2 participants