summaryrefslogtreecommitdiff
path: root/stwcs/wcsutil/altwcs.py
diff options
context:
space:
mode:
Diffstat (limited to 'stwcs/wcsutil/altwcs.py')
-rw-r--r--stwcs/wcsutil/altwcs.py14
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)