From 3262a4afa935fdd89e40f30e0a254cf0b6eeaf8e Mon Sep 17 00:00:00 2001 From: hack Date: Thu, 17 Mar 2011 21:29:33 +0000 Subject: This update to the HSTWCS class in STWCS attempts to address a couple of issues: namely, makes recognition of non-HST data more general (slightly) and only applies distortion model in all_sky2pix when it is present. The first change should allow HSTWCS to be run on data created with IRAF's artdata package/task. git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12216 fe389314-cf27-0410-b35b-8c050e845b92 --- wcsutil/hstwcs.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'wcsutil/hstwcs.py') diff --git a/wcsutil/hstwcs.py b/wcsutil/hstwcs.py index e85fa21..907f215 100644 --- a/wcsutil/hstwcs.py +++ b/wcsutil/hstwcs.py @@ -53,8 +53,11 @@ class HSTWCS(WCS): if fobj != None: filename, hdr0, ehdr, phdu = getinput.parseSingleInput(f=fobj, ext=ext) self.filename = filename - self.instrument = hdr0.get('INSTRUME', 'DEFAULT') - + instrument_name = hdr0.get('INSTRUME', 'DEFAULT') + if instrument_name in ['IRAF/ARTDATA','',' ','N/A']: + self.instrument = 'DEFAULT' + else: + self.instrument = instrument_name WCS.__init__(self, ehdr, fobj=phdu, minerr=self.minerr, key=self.wcskey) # If input was a pyfits HDUList object, it's the user's # responsibility to close it, otherwise, it's closed here. @@ -355,7 +358,11 @@ class HSTWCS(WCS): # Use linear WCS as frame in which to perform fit # rather than on the sky - wcslin = utils.output_wcs([self]) + undistort = True + if self.sip is None: + # Only apply distortion if distortion coeffs are present. + undistort = False + wcslin = utils.output_wcs([self],undistort=undistort) # We can only transform 1 position at a time for r,d,n in zip(ra,dec,xrange(len(ra))): @@ -427,7 +434,6 @@ class HSTWCS(WCS): ext_hdr.update('IDCV2REF', self.idcmodel.refpix['V2REF']) ext_hdr.update('IDCV3REF', self.idcmodel.refpix['V3REF']) - def printwcs(self): """ Print the basic WCS keywords. -- cgit