desihub / desispec

DESI spectral pipeline
BSD 3-Clause "New" or "Revised" License
33 stars 24 forks source link

Ctenightcheck #2213

Closed akremin closed 3 months ago

akremin commented 3 months ago

This resolved issue #2197 in which the ctecorr code crashes if all table entries are from a different night than the night being processed. However, we want to support this case since there are nights with no valid calibration data where we need to link the information from another night.

This introduces a new function desispec.util.difference_nights that uses datetime.date to handle the difference in days between two nights. The ctecorr code is updated to accept any calibration data within 14 days of the current night being processed (either before or after the current night).

I've tested this on the test night that originally identified the problem, and it now runs in this branch. I also tested on a new night I set up to link the ctecorrnight from a different night, and it worked for jobs on that test night as well.