diff options
author | dencheva <dencheva@stsci.edu> | 2008-08-22 13:59:11 -0400 |
---|---|---|
committer | dencheva <dencheva@stsci.edu> | 2008-08-22 13:59:11 -0400 |
commit | b003de463c45950a475892c8f5316c2f13a7536f (patch) | |
tree | 773f31bc7fe0149be7576667d2403c4c53fa771c /lib/__init__.py | |
parent | 33107fbdd5bba3625c63bf944cfb7a927f18cd1e (diff) | |
download | stwcs_hcf-b003de463c45950a475892c8f5316c2f13a7536f.tar.gz |
- HSTWCS class was modified to
- not keep the headers as attributes
- accept an adittional paramter fobj, consistent with SIP and WCS classes.
- The restore method was renamed to get_archive and moved to utils
- corrections classes:
- updateWCS were turned into classmethods
- diff_abgles was moved to utils
- restoreWCS() was moved to utils
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/development/trunk/hstwcs@6973 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/__init__.py')
-rw-r--r-- | lib/__init__.py | 47 |
1 files changed, 4 insertions, 43 deletions
diff --git a/lib/__init__.py b/lib/__init__.py index 08e421b..c9dca75 100644 --- a/lib/__init__.py +++ b/lib/__init__.py @@ -1,47 +1,8 @@ -import wcsutil -from wcsutil import HSTWCS -from pytools import fileutil, parseinput -import pyfits - -#to avoid relative imports +#import all needed modules here to avoid relative imports import mappings -from mappings import basic_wcs +import utils import distortion import pywcs -def restoreWCS(fnames): - """ - Given a list of fits file names restore the original basic WCS kw - and write out the files. This overwrites the original files. - """ - files = parseinput.parseinput(fnames)[0] - for f in files: - isfits, ftype = fileutil.isFits(f) - if not isfits or (isfits and ftype == 'waiver'): - print "RestoreWCS works only on multiextension fits files." - return - else: - fobj = pyfits.open(f, mode='update') - hdr0 = fobj[0].header - for ext in fobj: - try: - extname = ext.header['EXTNAME'].lower() - except KeyError: - continue - if extname in ['sci', 'err', 'sdq']: - hdr = ext.header - owcs = HSTWCS(hdr0, hdr) - #Changed restore to update the attributes ??? - # this may need to be changed - backup = owcs.restore() - if not backup: - print '\No archived keywords found.\n' - continue - else: - for kw in basic_wcs: - nkw = ('O'+kw)[:7] - if backup.has_key(kw): - hdr.update(kw, hdr[nkw]) - fobj.close() - - + +
\ No newline at end of file |