From 6bb64a6bb37a2635516bcc5403a536afb8e841d3 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 18 May 2018 18:38:15 +0000 Subject: [PATCH] Updated astropy error catching --- banzai/utils/fits_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/banzai/utils/fits_utils.py b/banzai/utils/fits_utils.py index e1f0b30cc..9b6e57efa 100755 --- a/banzai/utils/fits_utils.py +++ b/banzai/utils/fits_utils.py @@ -113,19 +113,19 @@ def parse_ra_dec(header): coord = SkyCoord(header.get('RA'), header.get('DEC'), unit=(units.hourangle, units.degree)) ra = coord.ra.deg dec = coord.dec.deg - except ValueError: + except (ValueError, TypeError): # Fallback to CRVAL1 and CRVAL2 try: coord = SkyCoord(header.get('CRVAl1'), header.get('CRVAL2'), unit=(units.degree, units.degree)) ra = coord.ra.deg dec = coord.dec.deg - except ValueError: + except (ValueError, TypeError): # Fallback to Cat-RA and CAT-DEC try: coord = SkyCoord(header.get('CAT-RA'), header.get('CAT-DEC'), unit=(units.hourangle, units.degree)) ra = coord.ra.deg dec = coord.dec.deg - except ValueError as e: + except (ValueError, TypeError) as e: logger.error('Could not get initial pointing guess. {0}'.format(e), extra={'tags': {'filename': header.get('ORIGNAME')}}) ra, dec = np.nan, np.nan