summaryrefslogtreecommitdiff
path: root/stwcs
diff options
context:
space:
mode:
authorMihai Cara <mihail.cara@gmail.com>2016-08-09 16:20:48 -0400
committerMihai Cara <mihail.cara@gmail.com>2016-08-09 16:20:48 -0400
commit8b5274f3ade9b67178e8e834a778936f21038713 (patch)
tree894e36aa2089963423a9703fbb65b8a3410fba47 /stwcs
parentdd06f2a94c0e70c2cad40247fcc21e55f1f8d10e (diff)
downloadstwcs_hcf-8b5274f3ade9b67178e8e834a778936f21038713.tar.gz
Fixes a bug (ValueError crash in applying headerlets using ``apply_as_primary``) revealed in Footprints ticket no. 9151
Diffstat (limited to 'stwcs')
-rw-r--r--stwcs/wcsutil/headerlet.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/stwcs/wcsutil/headerlet.py b/stwcs/wcsutil/headerlet.py
index 0a2e90b..5a980aa 100644
--- a/stwcs/wcsutil/headerlet.py
+++ b/stwcs/wcsutil/headerlet.py
@@ -1988,10 +1988,8 @@ class Headerlet(fits.HDUList):
# Update WCS with HDRNAME as well
for kw in ['SIMPLE', 'BITPIX', 'NAXIS', 'EXTEND']:
- try:
+ if kw in priwcs[0].header:
priwcs[0].header.remove(kw)
- except ValueError:
- pass
priwcs[0].header.set('WCSNAME', self[0].header['WCSNAME'], "")
priwcs[0].header.set('WCSAXES', self[('SIPWCS', i)].header['WCSAXES'], "")