Open sbailey opened 2 months ago
I had a look at that.
my understanding is:
(TARGET_RA, TARGET_DEC)
are nan
;(FIBER_RA, FIBER_DEC)
, which apparently assigns those default values to non-valid coordinates: (200.54410769651886 -50.326107696518925)
; I guess that the dec=-50 means "this obviously is a non-real value", as desi cannot go that south;expid=87354
is a split exposure (i.e. same tileid=11 than expid=87353
); apparently, in that case, platemaker doesn t provide those (FIBER_RA, FIBER_DEC)
columns; in that case, I guess that the fibermap code ends up with (TARGET_RA, TARGET_DEC) = (0, 0)
.I don t see an obvious way to fix that at the exposure level, as I guess the thing to do would be to use for expid=87354
the coordinates from expid=87353
, but as the code is run per-exposure, one cannot play such games.
though, for the cumulative and healpix reductions, one could intercept that with a logic like: if there are split exposures, check the (TARGET_RA, TARGET_DEC)
for negative TARGETID
s, and in case of discrepancy use the values of the first exposure.
the relevant part of the fibermap code should be:
https://github.com/desihub/desispec/blob/abfec75c3cd96bd9eca000125fc80aca8afcc4c8/py/desispec/io/fibermap.py#L891-L897
and
https://github.com/desihub/desispec/blob/abfec75c3cd96bd9eca000125fc80aca8afcc4c8/py/desispec/io/fibermap.py#L991-L999
if useful, illustrating what s in the coordinates
files:
>>> d = Table(fitsio.read("/global/cfs/cdirs/desi/spectro/data/20210505/00087353/coordinates-00087353.fits","DATA"))
>>> d.colnames
['PETAL_LOC', 'DEVICE_LOC', 'POS_Q', 'POS_S', 'POS_FLAGS', 'POS_X', 'POS_Y', 'TARGET_RA', 'TARGET_DEC', 'FA_X', 'FA_Y', 'FA_FIBER', 'REQ_Q', 'REQ_S', 'REQ_X', 'REQ_Y', 'EXP_Q_0', 'EXP_S_0', 'FLAGS_EXP_0', 'EXP_X_0', 'EXP_Y_0', 'FVC_X_0', 'FVC_Y_0', 'FLAGS_FVC_0', 'CNT_X_0', 'CNT_Y_0', 'FLAGS_CNT_0', 'CNT_MAG_0', 'CNT_ERR_0', 'DX_0', 'DY_0', 'FPA_X_0', 'FPA_Y_0', 'FLAGS_COR_0', 'REQ_X_0', 'REQ_Y_0', 'OFFSET_0', 'EXP_Q_1', 'EXP_S_1', 'FLAGS_EXP_1', 'EXP_X_1', 'EXP_Y_1', 'FVC_X_1', 'FVC_Y_1', 'FLAGS_FVC_1', 'CNT_X_1', 'CNT_Y_1', 'FLAGS_CNT_1', 'CNT_MAG_1', 'CNT_ERR_1', 'DX_1', 'DY_1', 'FPA_X_1', 'FPA_Y_1', 'FLAGS_COR_1', 'REQ_X_1', 'REQ_Y_1', 'OFFSET_1', 'FIBER_RA', 'FIBER_DEC', 'FIBER_X', 'FIBER_Y', 'FIBER_DX', 'FIBER_DY', 'FIBER_OFFSET']
>>> d["FA_X", "FA_Y", "FIBER_RA", "FIBER_DEC"][d["FA_FIBER"] == 1763]
<Table length=1>
FA_X FA_Y FIBER_RA FIBER_DEC
float32 float32 float64 float64
------- ------- ------------------ -------------------
nan nan 200.54410769651886 -50.326107696518925
>>> d = Table(fitsio.read("/global/cfs/cdirs/desi/spectro/data/20210505/00087354/coordinates-00087354.fits","DATA"))
>>> d.colnames
['PETAL_LOC', 'DEVICE_LOC', 'POS_Q', 'POS_S', 'POS_FLAGS', 'POS_X', 'POS_Y', 'TARGET_RA', 'TARGET_DEC', 'FA_X', 'FA_Y', 'FA_FIBER', 'FOR_DX_1', 'FOR_DY_1', 'FOR_X_1', 'FOR_Y_1', 'FLAGS_FOR_1', 'FOR_OFFSET_1', 'EXP_Q_0', 'EXP_S_0', 'FLAGS_EXP_0', 'EXP_X_0', 'EXP_Y_0', 'FVC_X_0', 'FVC_Y_0', 'FLAGS_FVC_0', 'CNT_X_0', 'CNT_Y_0', 'FLAGS_CNT_0', 'CNT_MAG_0', 'CNT_ERR_0', 'DX_0', 'DY_0', 'FPA_X_0', 'FPA_Y_0', 'FLAGS_COR_0', 'REQ_X_0', 'REQ_Y_0', 'OFFSET_0']
>>> d["FA_X", "FA_Y", "FIBER_RA", "FIBER_DEC"][d["FA_FIBER"] == 1763]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/conda/lib/python3.10/site-packages/astropy/table/table.py", line 2071, in __getitem__
[self[x] for x in item], copy_indices=self._copy_indices
File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/conda/lib/python3.10/site-packages/astropy/table/table.py", line 2071, in <listcomp>
[self[x] for x in item], copy_indices=self._copy_indices
File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/conda/lib/python3.10/site-packages/astropy/table/table.py", line 2062, in __getitem__
return self.columns[item]
File "/global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/conda/lib/python3.10/site-packages/astropy/table/table.py", line 265, in __getitem__
return OrderedDict.__getitem__(self, item)
KeyError: 'FIBER_RA'
and a side-comment:
those (TARGET_RA, TARGET_DEC) ~ (200, -50)
from platemaker probably happened for other tiles.
I m not familiar with DESINAME
is used / propagated downstream, but it could be that all such cases would end up with the same DESINAME
?
if useful, here s a check of the number of rows with abs(TARGET_DEC + 50) < 1
in the ztile-fits files (same results for the zpix-fits files):
>>> for fn in sorted(glob("/global/cfs/cdirs/desi/spectro/redux/kibo/zcatalog/v1/ztile-*fits")):
... decs = fitsio.read(fn, "ZCATALOG", columns="TARGET_DEC")
... print((np.abs(decs + 50) < 1).sum(), "\t", os.path.basename(fn))
...
0 ztile-cmx-other-cumulative.fits
0 ztile-main-backup-cumulative.fits
0 ztile-main-bright-cumulative.fits
0 ztile-main-dark-cumulative.fits
0 ztile-special-backup-cumulative.fits
0 ztile-special-bright-cumulative.fits
0 ztile-special-dark-cumulative.fits
198 ztile-sv1-backup-cumulative.fits
0 ztile-sv1-bright-cumulative.fits
0 ztile-sv1-dark-cumulative.fits
0 ztile-sv1-other-cumulative.fits
15 ztile-sv2-backup-cumulative.fits
270 ztile-sv2-bright-cumulative.fits
245 ztile-sv2-dark-cumulative.fits
575 ztile-sv3-backup-cumulative.fits
2740 ztile-sv3-bright-cumulative.fits
3246 ztile-sv3-dark-cumulative.fits
@sbailey: for info, I m running separate few sanity checks on kibo, and I stumbled on those again, I believe.
I m parsing the healpix redrock files (EXT_FIBERMAP) extension: I see a fair number of sv1 (backup), sv2 (backup, bright, dark), and sv3 (backup, bright, dark) files which have, for all rows, np.nan for PLATE_RA, PLATE_DEC. spot-checking a few, those only contain those TARGET_DEC~-50 fibers; i.e. I understand the code "group" those in the healpix pixels at dec ~ -50. I can provide a list if useful.
for completeness / book-keeping, here s a list of those healpix files (identified with np.nan for PLATE_RA or PLATE_DEC):
# NROW_NAN NROW_ALL FN
#
10 10 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/380/38007/redrock-sv1-backup-38007.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/432/43218/redrock-sv1-backup-43218.fits
25 25 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/421/42103/redrock-sv1-backup-42103.fits
8 8 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/473/47376/redrock-sv1-backup-47376.fits
85 85 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/418/41851/redrock-sv1-backup-41851.fits
70 70 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/421/42172/redrock-sv1-backup-42172.fits
40 40 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/473/47314/redrock-sv1-backup-47314.fits
68 68 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/476/47629/redrock-sv1-backup-47629.fits
25 25 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv1/backup/459/45947/redrock-sv1-backup-45947.fits
#
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/backup/419/41952/redrock-sv2-backup-41952.fits
#
60 60 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/419/41952/redrock-sv2-bright-41952.fits
105 105 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/419/41931/redrock-sv2-bright-41931.fits
60 60 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/419/41927/redrock-sv2-bright-41927.fits
45 45 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/418/41851/redrock-sv2-bright-41851.fits
30 30 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/418/41852/redrock-sv2-bright-41852.fits
105 105 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/425/42507/redrock-sv2-bright-42507.fits
30 30 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/425/42528/redrock-sv2-bright-42528.fits
45 45 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/419/41934/redrock-sv2-bright-41934.fits
90 90 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/425/42508/redrock-sv2-bright-42508.fits
45 45 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/418/41853/redrock-sv2-bright-41853.fits
75 75 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/419/41936/redrock-sv2-bright-41936.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/bright/418/41847/redrock-sv2-bright-41847.fits
#
14 14 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/425/42509/redrock-sv2-dark-42509.fits
30 30 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/419/41934/redrock-sv2-dark-41934.fits
28 28 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/419/41927/redrock-sv2-dark-41927.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/425/42514/redrock-sv2-dark-42514.fits
30 30 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/425/42507/redrock-sv2-dark-42507.fits
14 14 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/425/42503/redrock-sv2-dark-42503.fits
30 30 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/419/41931/redrock-sv2-dark-41931.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/425/42528/redrock-sv2-dark-42528.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/425/42508/redrock-sv2-dark-42508.fits
30 30 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/418/41853/redrock-sv2-dark-41853.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/419/41936/redrock-sv2-dark-41936.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/418/41852/redrock-sv2-dark-41852.fits
14 14 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/418/41851/redrock-sv2-dark-41851.fits
26 26 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/419/41952/redrock-sv2-dark-41952.fits
14 14 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv2/dark/418/41847/redrock-sv2-dark-41847.fits
#
110 110 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/422/42252/redrock-sv3-backup-42252.fits
46 46 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/459/45947/redrock-sv3-backup-45947.fits
14 14 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/421/42103/redrock-sv3-backup-42103.fits
19 19 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/473/47307/redrock-sv3-backup-47307.fits
72 72 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/422/42258/redrock-sv3-backup-42258.fits
42 42 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/432/43218/redrock-sv3-backup-43218.fits
67 67 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/421/42172/redrock-sv3-backup-42172.fits
77 77 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/418/41847/redrock-sv3-backup-41847.fits
78 78 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/418/41851/redrock-sv3-backup-41851.fits
34 34 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/473/47367/redrock-sv3-backup-47367.fits
133 133 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/425/42503/redrock-sv3-backup-42503.fits
47 47 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/472/47223/redrock-sv3-backup-47223.fits
15 15 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/473/47312/redrock-sv3-backup-47312.fits
31 31 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/backup/472/47227/redrock-sv3-backup-47227.fits
#
98 98 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/422/42247/redrock-sv3-bright-42247.fits
213 213 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/418/41851/redrock-sv3-bright-41851.fits
252 252 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/422/42258/redrock-sv3-bright-42258.fits
159 159 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/421/42103/redrock-sv3-bright-42103.fits
34 34 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/422/42273/redrock-sv3-bright-42273.fits
289 289 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/459/45947/redrock-sv3-bright-45947.fits
325 325 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/425/42503/redrock-sv3-bright-42503.fits
277 277 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/472/47223/redrock-sv3-bright-47223.fits
178 178 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/421/42172/redrock-sv3-bright-42172.fits
77 77 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/422/42253/redrock-sv3-bright-42253.fits
215 215 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/473/47312/redrock-sv3-bright-47312.fits
225 225 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/472/47227/redrock-sv3-bright-47227.fits
191 191 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/473/47367/redrock-sv3-bright-47367.fits
128 128 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/422/42256/redrock-sv3-bright-42256.fits
220 220 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/422/42252/redrock-sv3-bright-42252.fits
200 200 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/418/41847/redrock-sv3-bright-41847.fits
95 95 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/473/47307/redrock-sv3-bright-47307.fits
19 19 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/422/42251/redrock-sv3-bright-42251.fits
226 226 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/432/43218/redrock-sv3-bright-43218.fits
218 218 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/bright/476/47650/redrock-sv3-bright-47650.fits
#
76 76 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/422/42251/redrock-sv3-dark-42251.fits
57 57 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/422/42273/redrock-sv3-dark-42273.fits
130 130 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/422/42253/redrock-sv3-dark-42253.fits
246 246 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/418/41847/redrock-sv3-dark-41847.fits
266 266 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/425/42503/redrock-sv3-dark-42503.fits
314 314 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/418/41851/redrock-sv3-dark-41851.fits
276 276 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/472/47227/redrock-sv3-dark-47227.fits
212 212 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/472/47223/redrock-sv3-dark-47223.fits
361 361 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/422/42258/redrock-sv3-dark-42258.fits
409 409 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/421/42172/redrock-sv3-dark-42172.fits
417 417 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/476/47650/redrock-sv3-dark-47650.fits
346 346 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/432/43218/redrock-sv3-dark-43218.fits
291 291 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/473/47312/redrock-sv3-dark-47312.fits
250 250 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/473/47367/redrock-sv3-dark-47367.fits
57 57 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/473/47307/redrock-sv3-dark-47307.fits
403 403 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/421/42103/redrock-sv3-dark-42103.fits
217 217 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/422/42252/redrock-sv3-dark-42252.fits
346 346 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/422/42256/redrock-sv3-dark-42256.fits
191 191 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/422/42247/redrock-sv3-dark-42247.fits
398 398 /global/cfs/cdirs/desi/spectro/redux/kibo/healpix/sv3/dark/459/45947/redrock-sv3-dark-45947.fits
and here s the sky distribution of the kibo tilepix.fits
file (where one can see those at dec ~ -50):
Tile 11 observed on 20210505 exposures 87353 and 87354 had a set of stuck positioners that got assigned different TARGET_RA, TARGET_DEC for the two exposures.
From kibo/preproc/20210505/00087353/fibermap-00087353.fits
From kibo/preproc/20210505/00087354/fibermap-00087354.fits
It looks like in one case the code is assigning default values to something way off the tile, and in another case assigning them to 0.0 (which I thought we had previously fixed...).
These are all bad targets and thus aren't particularly high priority, but we should understand the bookkeeping of this and get it standardized. It lead to the healpix bookeeping issue in #2354 due to different fibermaps of the same tile covering different healpix.