From f75d2e8188947907dbe0ae062dbb2b12b13b0b47 Mon Sep 17 00:00:00 2001 From: Griffin Hosseinzadeh <1976665+griffin-h@users.noreply.github.com> Date: Thu, 1 Dec 2022 20:16:16 -0700 Subject: [PATCH 1/2] send camera name to astrometry.net service for SIP correction --- banzai/astrometry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/banzai/astrometry.py b/banzai/astrometry.py index 4b520ac78..94cfe6926 100755 --- a/banzai/astrometry.py +++ b/banzai/astrometry.py @@ -49,6 +49,7 @@ def do_stage(self, image): 'naxis2': image.shape[0], 'ra': image.ra, 'dec': image.dec, + 'camera_name': image.camera, 'statistics': False, 'filename': image.filename} try: From d24d54a3dab5aad17ea1d02cb52514e52edbe95d Mon Sep 17 00:00:00 2001 From: Griffin Hosseinzadeh <1976665+griffin-h@users.noreply.github.com> Date: Thu, 1 Dec 2022 20:16:19 -0700 Subject: [PATCH 2/2] copy SIP coefficients from astrometry.net service into header --- banzai/astrometry.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/banzai/astrometry.py b/banzai/astrometry.py index 94cfe6926..902da71f5 100755 --- a/banzai/astrometry.py +++ b/banzai/astrometry.py @@ -73,16 +73,19 @@ def do_stage(self, image): image.meta['WCSERR'] = FAILED_WCS return image - if not astrometry_response.json()['solved']: + astrometry_json = astrometry_response.json() + if not astrometry_json['solved']: logger.warning('WCS solution failed.', image=image) image.meta['WCSERR'] = FAILED_WCS return image header_keywords_to_update = ['CTYPE1', 'CTYPE2', 'CRPIX1', 'CRPIX2', 'CRVAL1', - 'CRVAL2', 'CD1_1', 'CD1_2', 'CD2_1', 'CD2_2'] + 'CRVAL2', 'CD1_1', 'CD1_2', 'CD2_1', 'CD2_2', + 'SIPA_1_1', 'SIPA_0_2', 'SIPA_2_0', 'SIPB_1_1', 'SIPB_0_2', 'SIPB_2_0'] for keyword in header_keywords_to_update: - image.meta[keyword] = astrometry_response.json()[keyword] + if keyword in astrometry_json: + image.meta[keyword] = astrometry_json[keyword] image.meta['RA'], image.meta['DEC'] = get_ra_dec_in_sexagesimal(image.meta['CRVAL1'], image.meta['CRVAL2'])