From 01e52adcd0f676dfdeeeeab90bc587d0bb967dd1 Mon Sep 17 00:00:00 2001 From: Kian-Tat Lim Date: Wed, 26 Jun 2024 15:13:33 -0700 Subject: [PATCH] Canonicalize instrument name. --- src/ingest.py | 10 ++++++++++ src/presence.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ingest.py b/src/ingest.py index 42a1d93..7780906 100644 --- a/src/ingest.py +++ b/src/ingest.py @@ -164,6 +164,16 @@ def record_groups(resources: list[ResourcePath]) -> None: logger.exception("Error reading header for %s", res) try: instrument = header["INSTRUME"] + # Canonicalize instrument name + match instrument.lower(): + case "lsstcomcamsim" | "comcamsim": + instrument = "LSSTComCamSim" + case "lsstcomcam" | "comcam": + instrument = "LSSTComCam" + case "lsstcam": + instrument = "LSSTCam" + case "latiss": + instrument = "LATISS" groupid = header["GROUPID"] snap_number = int(header["CURINDEX"]) - 1 detector = header["RAFTBAY"] + "_" + header["CCDSLOT"] diff --git a/src/presence.py b/src/presence.py index 77607e0..1cc99fc 100644 --- a/src/presence.py +++ b/src/presence.py @@ -66,7 +66,7 @@ def presence(instrument: str, group_name: str, snap_index: int, detector_name: s return ({"error": True, "message": f"Unrecognized detector name {detector_name}"}, 400) key = f"GROUP:{instrument}:{group_name}:{snap_index}:{detector_name}" result = r.get(key) - if result: + if result is not None: logger.info(f"Found key {key}") if delete_seen: r.delete(key)