desihub / desispec

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

Incorrect "FILENAME" listed in raw data headers through Jan 4th 2021 #1376

Open akremin opened 3 years ago

akremin commented 3 years ago

In tracing back an issue with the keyword "FILENAME" in fiberflats I found that it stemmed from the raw data headers themselves.

For data up to and including 20210104, the "FILENAME" keyword doesn't follow the desi-<EXPID>.fits.fz template, and additionally the spectrograph listed in the file names are also discrepant with the actual spectrograph (SP) value and appear to be random.

Note below I'm looking at the "B1" headers. Spot checking other camera-spec combinations showed the same behavior.

Examples:

kremin@cori09:/global/cfs/cdirs/desi/spectro/data> fitsheader -e "B1" -k "FILENAME" ${DESI_SPECTRO_DATA}/20201214/*/desi-*.fits.fz
# HDU B1 in ./00067569/desi-00067569.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067569/sp7-00067569.fits.fz' / Name 
# HDU B1 in ./00067570/desi-00067570.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067570/sp2-00067570.fits.fz' / Name 
# HDU B1 in ./00067571/desi-00067571.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067571/sp8-00067571.fits.fz' / Name 
# HDU B1 in ./00067572/desi-00067572.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067572/sp3-00067572.fits.fz' / Name 
# HDU B1 in ./00067573/desi-00067573.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067573/sp7-00067573.fits.fz' / Name 
# HDU B1 in ./00067574/desi-00067574.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067574/sp4-00067574.fits.fz' / Name 
# HDU B1 in ./00067575/desi-00067575.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067575/sp4-00067575.fits.fz' / Name 
# HDU B1 in ./00067576/desi-00067576.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067576/sp8-00067576.fits.fz' / Name 
# HDU B1 in ./00067577/desi-00067577.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067577/sp4-00067577.fits.fz' / Name 
# HDU B1 in ./00067578/desi-00067578.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067578/sp3-00067578.fits.fz' / Name 
# HDU B1 in ./00067579/desi-00067579.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067579/sp3-00067579.fits.fz' / Name 
# HDU B1 in ./00067580/desi-00067580.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067580/sp2-00067580.fits.fz' / Name 
# HDU B1 in ./00067581/desi-00067581.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067581/sp0-00067581.fits.fz' / Name 
# HDU B1 in ./00067582/desi-00067582.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067582/sp3-00067582.fits.fz' / Name 
# HDU B1 in ./00067583/desi-00067583.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067583/sp8-00067583.fits.fz' / Name 
# HDU B1 in ./00067584/desi-00067584.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067584/sp7-00067584.fits.fz' / Name 
# HDU B1 in ./00067585/desi-00067585.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067585/sp0-00067585.fits.fz' / Name 
# HDU B1 in ./00067586/desi-00067586.fits.fz:
FILENAME= '/exposures/desi/specs/20201214/00067586/sp2-00067586.fits.fz' / Name 
.... (truncated)
sbailey commented 3 years ago

Is this discrepancy just confusing, or are we actually using FILENAME downstream to do something?

We could consider intercepting and correcting or dropping this keyword as a special case in desi_preproc. Spot checking data from 20210615, it appears that keyword no longer exists.

akremin commented 3 years ago

I don't know of any downstream pipeline issues with it, but it is being propagated to our data products (I found it via looking at the fiberflats). So those files no longer document the raw data they were derived from, and point to files that don't exist.

I was using this to find the raw data associated with each derived file to find additional metadata that wasn't being propagated into the fibermap or header. Because of the issue, I instead assume the raw data used was in the nominal $DESI_SPECTRO_DATA, which is fine for my purposes.

I now see that you are correct, the keyword was dropped in later raw data. However, it is re-derived somewhere in the pipeline because the data products on those later nights still have it.

Frames for June 15, 2021:

kremin@cori07:/global/cfs/cdirs/desi/spectro/redux/everest/exposures> fitsheader -e 0 -k "FILENAME" ./20210615/*/frame*b1*fits
# HDU 0 in ./20210615/00094674/frame-b1-00094674.fits:
FILENAME= '/exposures/desi/20210615/00094674/desi-00094674.fits.fz'             
# HDU 0 in ./20210615/00094675/frame-b1-00094675.fits:
FILENAME= '/exposures/desi/20210615/00094675/desi-00094675.fits.fz'             
# HDU 0 in ./20210615/00094676/frame-b1-00094676.fits:
FILENAME= '/exposures/desi/20210615/00094676/desi-00094676.fits.fz'             
# HDU 0 in ./20210615/00094677/frame-b1-00094677.fits:
FILENAME= '/exposures/desi/20210615/00094677/desi-00094677.fits.fz'             
# HDU 0 in ./20210615/00094678/frame-b1-00094678.fits:
FILENAME= '/exposures/desi/20210615/00094678/desi-00094678.fits.fz'             
# HDU 0 in ./20210615/00094679/frame-b1-00094679.fits:
FILENAME= '/exposures/desi/20210615/00094679/desi-00094679.fits.fz'             
# HDU 0 in ./20210615/00094680/frame-b1-00094680.fits:
FILENAME= '/exposures/desi/20210615/00094680/desi-00094680.fits.fz'             
# HDU 0 in ./20210615/00094681/frame-b1-00094681.fits:
FILENAME= '/exposures/desi/20210615/00094681/desi-00094681.fits.fz'             
# HDU 0 in ./20210615/00094682/frame-b1-00094682.fits:
FILENAME= '/exposures/desi/20210615/00094682/desi-00094682.fits.fz'             
# HDU 0 in ./20210615/00094683/frame-b1-00094683.fits:
FILENAME= '/exposures/desi/20210615/00094683/desi-00094683.fits.fz'             
# HDU 0 in ./20210615/00094684/frame-b1-00094684.fits:
FILENAME= '/exposures/desi/20210615/00094684/desi-00094684.fits.fz'             
# HDU 0 in ./20210615/00094685/frame-b1-00094685.fits:
FILENAME= '/exposures/desi/20210615/00094685/desi-00094685.fits.fz'             
# HDU 0 in ./20210615/00094686/frame-b1-00094686.fits:
FILENAME= '/exposures/desi/20210615/00094686/desi-00094686.fits.fz'             
# HDU 0 in ./20210615/00094687/frame-b1-00094687.fits:
FILENAME= '/exposures/desi/20210615/00094687/desi-00094687.fits.fz'             
# HDU 0 in ./20210615/00094688/frame-b1-00094688.fits:
FILENAME= '/exposures/desi/20210615/00094688/desi-00094688.fits.fz'             
# HDU 0 in ./20210615/00094689/frame-b1-00094689.fits:
FILENAME= '/exposures/desi/20210615/00094689/desi-00094689.fits.fz'             
# HDU 0 in ./20210615/00094690/frame-b1-00094690.fits:
FILENAME= '/exposures/desi/20210615/00094690/desi-00094690.fits.fz'             
# HDU 0 in ./20210615/00094691/frame-b1-00094691.fits:
FILENAME= '/exposures/desi/20210615/00094691/desi-00094691.fits.fz'  
.... (truncated)

For reference, Dec 2020 frames where the issue still presents itself:

kremin@cori07:/global/cfs/cdirs/desi/spectro/redux/everest/exposures> fitsheader -e 0 -k "FILENAME" ./20201214/*/frame*b1*fits
# HDU 0 in ./20201214/00067628/frame-b1-00067628.fits:
FILENAME= '/exposures/desi/specs/20201214/00067628/sp8-00067628.fits.fz' / Name 
# HDU 0 in ./20201214/00067629/frame-b1-00067629.fits:
FILENAME= '/exposures/desi/specs/20201214/00067629/sp7-00067629.fits.fz' / Name 
# HDU 0 in ./20201214/00067630/frame-b1-00067630.fits:
FILENAME= '/exposures/desi/specs/20201214/00067630/sp6-00067630.fits.fz' / Name 
# HDU 0 in ./20201214/00067633/frame-b1-00067633.fits:
FILENAME= '/exposures/desi/specs/20201214/00067633/sp4-00067633.fits.fz' / Name 
# HDU 0 in ./20201214/00067634/frame-b1-00067634.fits:
FILENAME= '/exposures/desi/specs/20201214/00067634/sp1-00067634.fits.fz' / Name 
# HDU 0 in ./20201214/00067635/frame-b1-00067635.fits:
FILENAME= '/exposures/desi/specs/20201214/00067635/sp0-00067635.fits.fz' / Name 
# HDU 0 in ./20201214/00067638/frame-b1-00067638.fits:
FILENAME= '/exposures/desi/specs/20201214/00067638/sp6-00067638.fits.fz' / Name 
# HDU 0 in ./20201214/00067639/frame-b1-00067639.fits:
FILENAME= '/exposures/desi/specs/20201214/00067639/sp8-00067639.fits.fz' / Name 
# HDU 0 in ./20201214/00067640/frame-b1-00067640.fits:
FILENAME= '/exposures/desi/specs/20201214/00067640/sp8-00067640.fits.fz' / Name 
# HDU 0 in ./20201214/00067643/frame-b1-00067643.fits:
FILENAME= '/exposures/desi/specs/20201214/00067643/sp6-00067643.fits.fz' / Name 
# HDU 0 in ./20201214/00067644/frame-b1-00067644.fits:
FILENAME= '/exposures/desi/specs/20201214/00067644/sp4-00067644.fits.fz' / Name 
# HDU 0 in ./20201214/00067645/frame-b1-00067645.fits:
FILENAME= '/exposures/desi/specs/20201214/00067645/sp7-00067645.fits.fz' / Name 
.... (truncated)