From a8a900bd2e224ffe6a165d21e2c6acc04dfe5220 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 18 May 2018 18:36:39 +0000 Subject: [PATCH 1/5] Added null images change --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 3aac53cc0..2790a6308 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ - Fixed a bug that would stop preview frames from being retried if they failed even once. - Hotfix to remove double division by exposure time when creating master darks - Fixed bug that prevented calibration comparison being run on skyflats +- Fixed image class null case 0.9.3 (2018-05-10) ------------------ From 74445174a86203f33bab2abdc7ad70c3a54aed9f Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 18 May 2018 18:37:13 +0000 Subject: [PATCH 2/5] Fixed flats to skyflats --- banzai/flats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/banzai/flats.py b/banzai/flats.py index 3f1c733df..fee8db39c 100755 --- a/banzai/flats.py +++ b/banzai/flats.py @@ -126,7 +126,7 @@ def group_by_keywords(self): @property def calibration_type(self): - return 'flat' + return 'skyflat' def noise_model(self, image): flat_normalization = float(image.header['FLATLVL']) From 0e92d73787d5eaaf169cbc05053b7d83ea14ca5c Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 18 May 2018 18:37:28 +0000 Subject: [PATCH 3/5] Made null images work --- banzai/images.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/banzai/images.py b/banzai/images.py index 9d8bf7c08..3aab07884 100644 --- a/banzai/images.py +++ b/banzai/images.py @@ -62,11 +62,11 @@ def __init__(self, pipeline_context, filename=None, data=None, header=None, self.filter = header.get('FILTER') self.obstype = header.get('OBSTYPE') - self.exptime = float(header.get('EXPTIME')) - self.dateobs = date_utils.parse_date_obs(header.get('DATE-OBS')) - self.readnoise = float(header.get('RDNOISE')) + self.exptime = float(header.get('EXPTIME', 0.0)) + self.dateobs = date_utils.parse_date_obs(header.get('DATE-OBS', '1900-01-01T00:00:00.00000')) + self.readnoise = float(header.get('RDNOISE', 0.0)) self.ra, self.dec = fits_utils.parse_ra_dec(header) - self.pixel_scale = float(header.get('PIXSCALE')) + self.pixel_scale = float(header.get('PIXSCALE', 0.0)) self.catalog = None def subtract(self, value): From 00202660e2d64a14687f79ac684385133f742bfd Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 18 May 2018 18:37:46 +0000 Subject: [PATCH 4/5] Test null image --- banzai/tests/test_image.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 banzai/tests/test_image.py diff --git a/banzai/tests/test_image.py b/banzai/tests/test_image.py new file mode 100644 index 000000000..cb5991c2c --- /dev/null +++ b/banzai/tests/test_image.py @@ -0,0 +1,7 @@ +from banzai.images import Image +from banzai.tests.utils import FakeContext + + +def test_null_filename(): + test_image = Image(FakeContext, filename=None) + assert test_image.data is None From 6bb64a6bb37a2635516bcc5403a536afb8e841d3 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 18 May 2018 18:38:15 +0000 Subject: [PATCH 5/5] 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