From 0c520754e894daf62e706bc13d490f26cc55e506 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 3 Sep 2024 15:19:11 -0700 Subject: [PATCH] sort the fibermap table for zbest files --- py/desispec/scripts/zcatalog.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/py/desispec/scripts/zcatalog.py b/py/desispec/scripts/zcatalog.py index 6adff3d45..de145c898 100755 --- a/py/desispec/scripts/zcatalog.py +++ b/py/desispec/scripts/zcatalog.py @@ -138,10 +138,14 @@ def read_redrock(rrfile, group=None, recoadd_fibermap=False, minimal=False, pert log.info('Recoadding fibermap from %s', os.path.basename(spectra_filename)) fibermap_orig = read_table(spectra_filename) fibermap, expfibermap = coadd_fibermap(fibermap_orig, onetile=pertile) + if zbest_file: + fibermap.sort(['TARGETID']) else: fibermap = Table(fx['FIBERMAP'].read()) expfibermap = fx['EXP_FIBERMAP'].read() + assert np.all(redshifts['TARGETID'] == fibermap['TARGETID']) + try: tsnr2 = fx['TSNR2'].read() except IOError: @@ -150,8 +154,8 @@ def read_redrock(rrfile, group=None, recoadd_fibermap=False, minimal=False, pert # tsnr2 = None - assert np.all(redshifts['TARGETID'] == fibermap['TARGETID']) - assert np.all(redshifts['TARGETID'] == tsnr2['TARGETID']) + if tsnr2 is not None: + assert np.all(redshifts['TARGETID'] == tsnr2['TARGETID']) if minimal: # basic set of target information