Skip to content

Commit

Permalink
Merge pull request #112 from LCOGT/hotfix/null_images
Browse files Browse the repository at this point in the history
Hotfix/null images
  • Loading branch information
cmccully authored May 21, 2018
2 parents 7d0870e + 6bb64a6 commit b52ef01
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------
Expand Down
2 changes: 1 addition & 1 deletion banzai/flats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
8 changes: 4 additions & 4 deletions banzai/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 7 additions & 0 deletions banzai/tests/test_image.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions banzai/utils/fits_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b52ef01

Please sign in to comment.