diff options
author | Nadia Dencheva <dencheva@itsd-osx31.stsci.edu> | 2017-03-27 13:49:58 -0400 |
---|---|---|
committer | Nadia Dencheva <nadia.dencheva@gmail.com> | 2017-04-24 17:22:50 -0400 |
commit | c954b48e3866315e1a9191fb13d166cfcd9f2baf (patch) | |
tree | 24529ed97824f6a98b1318dfe4c4173b36575de1 /stwcs/wcsutil/altwcs.py | |
parent | 02e4c14b36e3f38f51cde969c6286af396cfab8d (diff) | |
download | stwcs_hcf-c954b48e3866315e1a9191fb13d166cfcd9f2baf.tar.gz |
save work
Diffstat (limited to 'stwcs/wcsutil/altwcs.py')
-rw-r--r-- | stwcs/wcsutil/altwcs.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/stwcs/wcsutil/altwcs.py b/stwcs/wcsutil/altwcs.py index 043d535..b166b61 100644 --- a/stwcs/wcsutil/altwcs.py +++ b/stwcs/wcsutil/altwcs.py @@ -1,6 +1,7 @@ from __future__ import absolute_import, division, print_function import string +import warnings import numpy as np from astropy import wcs as pywcs from astropy.io import fits @@ -9,6 +10,13 @@ from stsci.tools import fileutil as fu from astropy import log default_log_level = log.getEffectiveLevel() +warnings.filterwarnings("ignore", message="^Some non-standard WCS keywords were excluded:", module="astropy.wcs.wcs") + + +__all__ = ["archiveWCS", "available_wcskeys", "convertAltWCS", "deleteWCS", "next_wcskey", + "pc2cd", "readAltWCS", "restoreWCS", "wcskeys", "wcsnames"] + + altwcskw = ['WCSAXES', 'CRVAL', 'CRPIX', 'PC', 'CDELT', 'CD', 'CTYPE', 'CUNIT', 'PV', 'PS'] altwcskw_extra = ['LATPOLE', 'LONPOLE', 'RESTWAV', 'RESTFRQ'] @@ -151,6 +159,7 @@ def archiveWCS(fname, ext, wcskey=" ", wcsname=" ", reusekey=False): key = k[: 7] + wkey f[e].header[key] = hwcs[k] log.setLevel(default_log_level) + warnings.resetwarnings() closefobj(fname, f) @@ -432,10 +441,9 @@ def _restore(fobj, ukey, fromextnum, hdr = _getheader(fobj, fromextension) # keep a copy of the ctype because of the "-SIP" suffix. ctype = hdr['ctype*'] + w = pywcs.WCS(hdr, fobj, key=ukey) - log.setLevel('WARNING') hwcs = w.to_header() - log.setLevel(default_log_level) if hwcs is None: return @@ -518,9 +526,7 @@ def readAltWCS(fobj, ext, wcskey=' ', verbose=False): print('readAltWCS: Could not read WCS with key %s' % wcskey) print(' Skipping %s[%s]' % (fobj.filename(), str(ext))) return None - log.setLevel('WARNING') hwcs = nwcs.to_header() - log.setLevel(default_log_level) if nwcs.wcs.has_cd(): hwcs = pc2cd(hwcs, key=wcskey) |