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

stdstars robust to missing individual frames #1402

Merged
merged 1 commit into from Sep 3, 2021

Conversation

sbailey
Copy link
Contributor

@sbailey sbailey commented Sep 3, 2021

This PR fixes #1225 where multi-exposure stdstar fitting would fail if there was a single missing frame, even if other exposures from the same night had the camera.

e.g. tile 80694 on night 20210306: exposures 79570 had b8,r8,z8 but 79571 has only b8,r8 (z8 was lost due to a shutter light leak saturation event). Previously the pipeline would fail due to the missing frame-z8-00079571.fits, but with this branch it succeeds because frame-z8-00079570.fits is available for the same tile on the same night for the multi-exposure stdstar fit.

Example:

export DESI_SPECTRO_REDUX=/global/cfs/cdirs/desi/users/$USER/spectro/redux
export SPECPROD=noz8
cd $DESI_SPECTRO_REDUX
copyprod --night 20210306 /global/cfs/cdirs/desi/spectro/redux/everest $SPECPROD

desi_proc_joint_fit --traceshift --obstype science \
    --cameras a8 -n 20210306 -e 79570,79571

with current master:

...
ERROR:util.py:47:runcmd: missing input /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-z8-00079571.fits
ERROR:util.py:47:runcmd: missing input /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-z8-00079571.fits
TIMER-STOP:proc_joint_fit.py:437:main: Stopping stdstarfit at 2021-09-02T17:50:55.106724; duration 0.06 seconds
ERROR:proc_joint_fit.py:443:main: 1/1 stdstar commands failed
CRITICAL:proc_joint_fit.py:448:main: All stdstar commands failed

with this branch:

...
ERROR:proc_joint_fit.py:415:main: Missing expected frame /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-z8-00079571.fits
ERROR:proc_joint_fit.py:419:main: Missing expected sky /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-z8-00079571.fits
INFO:util.py:74:runcmd: Thu Sep  2 17:52:01 2021
INFO:util.py:75:runcmd: RUNNING: desi_fit_stdstars --delta-color 0.1 --frames /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-b8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-b8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-r8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-r8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-z8-00079570.fits --skymodels /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-b8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-b8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-r8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-r8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-z8-00079570.fits --fiberflats /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-b8-20210306.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-r8-20210306.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-z8-20210306.fits --starmodels /global/cfs/cdirs/desi/spectro/templates/basis_templates/v3.2/stdstar_templates_v2.2.fits --outfile /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/stdstars-8-00079570.fits
  Inputs
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-b8-00079570.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-b8-00079571.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-r8-00079570.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-r8-00079571.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-z8-00079570.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-b8-00079570.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-b8-00079571.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-r8-00079570.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-r8-00079571.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-z8-00079570.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-b8-20210306.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-r8-20210306.fits
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-z8-20210306.fits
  Outputs
    /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/stdstars-8-00079570.fits
...
INFO:util.py:113:runcmd: SUCCESS: desi_fit_stdstars --delta-color 0.1 --frames /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-b8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-b8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-r8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/frame-r8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/frame-z8-00079570.fits --skymodels /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-b8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-b8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-r8-00079570.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079571/sky-r8-00079571.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/sky-z8-00079570.fits --fiberflats /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-b8-20210306.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-r8-20210306.fits /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/calibnight/20210306/fiberflatnight-z8-20210306.fits --starmodels /global/cfs/cdirs/desi/spectro/templates/basis_templates/v3.2/stdstar_templates_v2.2.fits --outfile /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/noz8/exposures/20210306/00079570/stdstars-8-00079570.fits
...

Also tested:

  • srun -N 1 -n 2 -c 16 desi_proc_joint_fit --traceshift --obstype science --cameras a8 -n 20210306 -e 79570,79571 --mpi (i.e. the MPI logic works)
  • removing z8 files from all exposures and confirming that in that case it won't proceed with the stdstar fit.

@sbailey sbailey requested a review from akremin September 3, 2021 00:55
@sbailey sbailey added this to In progress in Fuji via automation Sep 3, 2021
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 26.698% when pulling c4250b3 on stdstars_missing_camera into 326e7b5 on master.

Copy link
Member

@akremin akremin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good. Adding efficiency in only having rank 0 do the selection of the files, and my tests were successful. I was able to reproduce the success of the example in the PR text. I also ran two of my own tests of zcam saturation events on April 12th. They were successful as well (including the commands below for future documentation).

export DESI_SPECTRO_REDUX=/global/cfs/cdirs/desi/users/$USER/spectro/redux
export SPECPROD=noz6
cd $DESI_SPECTRO_REDUX
copyprod --night 20210412 /global/cfs/cdirs/desi/spectro/redux/everest $SPECPROD

 rm /global/cfs/cdirs/desi/users/kremin/spectro/redux/noz6/exposures/20210412/0008451[678]/stdstars-6-*.fits
 
desi_proc_joint_fit --traceshift --obstype science \
    --cameras a67 -n 20210412 -e 84516,84517,84518

 rm ${DESI_SPECTRO_REDUX}/${SPECPROD}/exposures/20210412/0008453[678]/stdstars-6-*.fits
 
desi_proc_joint_fit --traceshift --obstype science \
    --cameras a67 -n 20210412 -e 84534,84535,84536

@sbailey sbailey merged commit ed75c52 into master Sep 3, 2021
Fuji automation moved this from In progress to Done Sep 3, 2021
@sbailey sbailey deleted the stdstars_missing_camera branch September 3, 2021 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Fuji
  
Done
Development

Successfully merging this pull request may close these issues.

stdstar logic when missing a camera
3 participants