From 5bb618eb05bbfbfab96472948db3d620198f16a7 Mon Sep 17 00:00:00 2001 From: anand_raichoor Date: Thu, 21 Dec 2023 17:40:50 -0800 Subject: [PATCH 1/2] create_petalnz_pdf(): look for redrock*fits instead of zmtl*fits --- py/desispec/night_qa.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/py/desispec/night_qa.py b/py/desispec/night_qa.py index 0086c2674..adde241fa 100644 --- a/py/desispec/night_qa.py +++ b/py/desispec/night_qa.py @@ -1437,13 +1437,21 @@ def create_petalnz_pdf( log.warning("{} : FAPRGRM={} not in bright, dark, proceeding to next tile".format(fn, faprgrm)) continue # AR reading zmtl files + # AR 20231221: look for redrock files, to handle case of + # AR a reprocessing generates a dummy zmtl file + # AR https://desisurvey.slack.com/archives/C01HNN87Y7J/p1703203812637849 istileid = False pix_ntilecovs = None for petal in petals: - fn = findfile('zmtl', night=night, tile=tileid, spectrograph=petal, groupname=group, specprod_dir=prod) + fn = findfile('redrock', night=night, tile=tileid, spectrograph=petal, groupname=group, specprod_dir=prod) if not os.path.isfile(fn): log.warning("{} : no file".format(fn)) else: + # AR switching to zmtl + fn = fn.replace("redrock", "zmtl") + if not os.path.isfile(fn): + log.warning("{} : no file".format(fn)) + continue istileid = True d = Table.read(fn, hdu="ZMTL") # AR rename *DESI_TARGET and *BGS_TARGET to DESI_TARGET and BGS_TARGET From fcee79421b2d82244ca6139559b97901a723a282 Mon Sep 17 00:00:00 2001 From: Stephen Bailey Date: Thu, 21 Dec 2023 18:20:32 -0800 Subject: [PATCH 2/2] desispec.io.util.replace_prefix instead of str.replace --- py/desispec/night_qa.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/desispec/night_qa.py b/py/desispec/night_qa.py index adde241fa..7d57bbe94 100644 --- a/py/desispec/night_qa.py +++ b/py/desispec/night_qa.py @@ -27,6 +27,7 @@ # AR desispec from desispec.fiberbitmasking import get_skysub_fiberbitmask_val from desispec.io import findfile +from desispec.io.util import replace_prefix from desispec.calibfinder import CalibFinder from desispec.scripts import preproc from desispec.tile_qa_plot import get_tilecov @@ -1448,7 +1449,7 @@ def create_petalnz_pdf( log.warning("{} : no file".format(fn)) else: # AR switching to zmtl - fn = fn.replace("redrock", "zmtl") + fn = replace_prefix(fn, "redrock", "zmtl") if not os.path.isfile(fn): log.warning("{} : no file".format(fn)) continue