From 07a14bed2aeb254ffd2859015e57787c28ee4ad8 Mon Sep 17 00:00:00 2001 From: lordrick94 Date: Mon, 18 May 2026 14:46:49 -0700 Subject: [PATCH] quick fix due numpy update --- frb/surveys/survey_utils.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/frb/surveys/survey_utils.py b/frb/surveys/survey_utils.py index 9a8ffe7b..b9523c46 100644 --- a/frb/surveys/survey_utils.py +++ b/frb/surveys/survey_utils.py @@ -1,6 +1,10 @@ """ utils related to SurveyCoord objects""" from urllib.error import HTTPError +try: + from dl.queryClient import queryClientError +except ImportError: + queryClientError = None from frb.surveys.nedlvs import NEDLVS from frb.surveys.sdss import SDSS_Survey from frb.surveys.des import DES_Survey @@ -133,6 +137,31 @@ def is_inside(surveyname:str, coord:SkyCoord)->bool: except HTTPError: warnings.warn("Couldn't reach MAST for PS1.", RuntimeWarning) cat = None + except Exception as e: + # Catch queryClientError and other connection errors (e.g., 502 Bad Gateway) + if queryClientError is not None and isinstance(e, queryClientError): + err_type = "NOIRLab Data Lab error" + elif "502" in str(e) or "Bad Gateway" in str(e): + err_type = "502 Bad Gateway" + else: + raise # Re-raise if it's an unexpected error + + print(f"\n{'='*60}") + print(f"ERROR: {err_type} while querying {surveyname}") + print(f"Coordinate: RA={coord.ra.deg:.6f}, Dec={coord.dec.deg:.6f}") + print(f"Error details: {str(e)[:200]}") + print(f"{'='*60}") + print(f"\nPlease verify manually if this coordinate is inside {surveyname}.") + print("You can check at: https://www.legacysurvey.org/viewer") + + while True: + user_input = input(f"Is coordinate inside {surveyname}? (true/false): ").strip().lower() + if user_input in ('true', 't', 'yes', 'y', '1'): + return True + elif user_input in ('false', 'f', 'no', 'n', '0'): + return False + else: + print("Invalid input. Please enter 'true' or 'false'.") # Are there any objects in the returned catalog? if cat is None or len(cat) == 0: return False