From c954b48e3866315e1a9191fb13d166cfcd9f2baf Mon Sep 17 00:00:00 2001 From: Nadia Dencheva Date: Mon, 27 Mar 2017 13:49:58 -0400 Subject: save work --- stwcs/updatewcs/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'stwcs/updatewcs/__init__.py') diff --git a/stwcs/updatewcs/__init__.py b/stwcs/updatewcs/__init__.py index 46faa72..fe326c3 100644 --- a/stwcs/updatewcs/__init__.py +++ b/stwcs/updatewcs/__init__.py @@ -1,6 +1,8 @@ from __future__ import absolute_import, division, print_function import atexit +import warnings + from astropy.io import fits from .. import wcsutil #from ..wcsutil.hwstwcs import HSTWCS @@ -25,6 +27,7 @@ atexit.register(logging.shutdown) # Note: The order of corrections is important +warnings.filterwarnings("ignore", message="^Some non-standard WCS keywords were excluded:", module="astropy.wcs") def updatewcs(input, vacorr=True, tddcorr=True, npolcorr=True, d2imcorr=True, checkfiles=True, verbose=False): @@ -119,7 +122,10 @@ def makecorr(fname, allowed_corr): f.readall() # Determine the reference chip and create the reference HSTWCS object nrefchip, nrefext = getNrefchip(f) + + log.setLevel("WARNING") wcsutil.restoreWCS(f, nrefext, wcskey='O') + log.setLevel(default_log_level) rwcs = wcsutil.HSTWCS(fobj=f, ext=nrefext) rwcs.readModel(update=True, header=f[nrefext].header) @@ -134,14 +140,18 @@ def makecorr(fname, allowed_corr): if 'extname' in extn.header: extname = extn.header['extname'].lower() if extname == 'sci': + log.setLevel("WARNING") wcsutil.restoreWCS(f, ext=i, wcskey='O') + log.setLevel(default_log_level) sciextver = extn.header['extver'] ref_wcs = rwcs.deepcopy() hdr = extn.header ext_wcs = wcsutil.HSTWCS(fobj=f, ext=i) # check if it exists first!!! # 'O ' can be safely archived again because it has been restored first. + # perhaps archive only if it doesn't exist??? wcsutil.archiveWCS(f, ext=i, wcskey="O", wcsname="OPUS", reusekey=True) + ext_wcs.readModel(update=True, header=hdr) for c in allowed_corr: if c != 'NPOLCorr' and c != 'DET2IMCorr': @@ -213,10 +223,7 @@ def copyWCS(w, ehdr): WCS of the 'SCI' extension to the headers of 'ERR', 'DQ', 'SDQ', 'TIME' or 'SAMP' extensions. """ - log.setLevel('WARNING') hwcs = w.to_header() - log.setLevel(default_log_level) - if w.wcs.has_cd(): wcsutil.pc2cd(hwcs) for k in hwcs.keys(): -- cgit From 1ca125a499c06ec1795a7ece6b1c2c63c8d9178b Mon Sep 17 00:00:00 2001 From: Nadia Dencheva Date: Mon, 24 Apr 2017 17:47:41 -0400 Subject: final tweaks --- stwcs/updatewcs/__init__.py | 1 - 1 file changed, 1 deletion(-) (limited to 'stwcs/updatewcs/__init__.py') diff --git a/stwcs/updatewcs/__init__.py b/stwcs/updatewcs/__init__.py index fe326c3..10fc80e 100644 --- a/stwcs/updatewcs/__init__.py +++ b/stwcs/updatewcs/__init__.py @@ -149,7 +149,6 @@ def makecorr(fname, allowed_corr): ext_wcs = wcsutil.HSTWCS(fobj=f, ext=i) # check if it exists first!!! # 'O ' can be safely archived again because it has been restored first. - # perhaps archive only if it doesn't exist??? wcsutil.archiveWCS(f, ext=i, wcskey="O", wcsname="OPUS", reusekey=True) ext_wcs.readModel(update=True, header=hdr) -- cgit