Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions frb/surveys/sdss.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Methods related to SDSS/BOSS queries """

import warnings
import numpy as np
from IPython import embed

Expand Down Expand Up @@ -89,6 +90,8 @@ def get_catalog(self, photoobj_fields=None, timeout=120, print_query=False):
# Validate
self.validate_catalog()
return
elif '<html>' in photom_catalog.colnames[0]:
raise RuntimeError("SDSS photometry query appears to have failed. Error message: {}".format(photom_catalog.colnames[0]+photom_catalog[0][0]))

# Now query for photo-z
query = "SELECT GN.distance, "
Expand All @@ -109,9 +112,15 @@ def get_catalog(self, photoobj_fields=None, timeout=120, print_query=False):

# Match em up
if photz_cat is not None:
matches = catalog_utils.match_ids(photz_cat['objid'], photom_catalog['objid'], require_in_match=False)
# Was there an error in the photo-z query?
if (len(photz_cat.colnames) == 1) &('<html>' in photz_cat.colnames[0]):
warnings.warn("Photo-z query appears to have failed; no photo-z will be included",category=RuntimeWarning)
photz_cat = None
matches = np.full(len(photom_catalog), fill_value=-1, dtype=int)
else:
matches = catalog_utils.match_ids(photz_cat['objid'], photom_catalog['objid'], require_in_match=False)
else:
matches = -1 * np.ones(len(photom_catalog), dtype=int)
matches = np.full(len(photom_catalog), fill_value=-1, dtype=int)
gdz = matches > 0
# Init
photom_catalog['photo_z'] = -9999.
Expand Down