From 3b873f14d1ec709fe6df3ab053ecff3f363c7510 Mon Sep 17 00:00:00 2001 From: dencheva Date: Tue, 28 Apr 2009 21:07:43 +0000 Subject: These changes allow the HSTWCS object ot be used for transformations and when updating the headers git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/development/trunk/updatewcs@7974 fe389314-cf27-0410-b35b-8c050e845b92 --- hstwcs/det2im.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'hstwcs/det2im.py') diff --git a/hstwcs/det2im.py b/hstwcs/det2im.py index 164eff6..90c9f28 100644 --- a/hstwcs/det2im.py +++ b/hstwcs/det2im.py @@ -20,7 +20,7 @@ class DET2IMCorr(object): else: new_kw = {'D2IMEXT': d2imfile, 'AXISCORR': axiscorr, 'D2IMERR': d2imerr} cls.applyDet2ImCorr(fobj, axiscorr) - return new_kw + cls.updatehdr(fobj, new_kw) updateWCS = classmethod(updateWCS) @@ -135,4 +135,21 @@ class DET2IMCorr(object): return hdr createDet2ImHdr = classmethod(createDet2ImHdr) + + def updatehdr(cls, fobj, kwdict): + """ + Update extension headers to keep record of the files used for the + detector to image correction. + """ + for ext in fobj: + try: + extname = ext.header['EXTNAME'].lower() + except KeyError: + continue + if extname == 'sci': + for kw in kwdict: + ext.header.update(kw, kwdict[kw]) + else: + continue + updatehdr = classmethod(updatehdr) \ No newline at end of file -- cgit