From bd432a46967bb359c3a6dc5b0430436c24ff0696 Mon Sep 17 00:00:00 2001 From: hack Date: Mon, 22 Sep 2014 20:00:57 +0000 Subject: Minor updates to HSTWCS to allow it to provide a uniform interface to some non-HST data as well as HST data. These changes only support data already supported by astropy.wcs and do not affect any aspect of HST support. No support for undistorting non-HST data should ever be implied or assumed. git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@34531 fe389314-cf27-0410-b35b-8c050e845b92 --- lib/stwcs/wcsutil/hstwcs.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/stwcs/wcsutil/hstwcs.py') diff --git a/lib/stwcs/wcsutil/hstwcs.py b/lib/stwcs/wcsutil/hstwcs.py index 8cc56ee..7618412 100644 --- a/lib/stwcs/wcsutil/hstwcs.py +++ b/lib/stwcs/wcsutil/hstwcs.py @@ -138,12 +138,15 @@ class HSTWCS(WCS): ext=ext) self.filename = filename instrument_name = hdr0.get('INSTRUME', 'DEFAULT') - if instrument_name in ['IRAF/ARTDATA','',' ','N/A']: + if instrument_name == 'DEFAULT' or instrument_name not in inst_mappings.keys(): + #['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 self.instrument == 'DEFAULT': + self.pc2cd() # If input was a `astropy.io.fits.HDUList` object, it's the user's # responsibility to close it, otherwise, it's closed here. if not isinstance(fobj, fits.HDUList): @@ -458,7 +461,9 @@ class HSTWCS(WCS): return cards def pc2cd(self): - self.wcs.cd = self.wcs.pc.copy() + if not self.wcs.has_pc(): + self.wcs.pc = self.wcs.get_pc() + self.wcs.cd = self.wcs.pc * self.wcs.cdelt[1] def all_world2pix(self, *args, **kwargs): """ -- cgit