diff options
author | dencheva <dencheva@stsci.edu> | 2010-01-19 12:16:25 -0500 |
---|---|---|
committer | dencheva <dencheva@stsci.edu> | 2010-01-19 12:16:25 -0500 |
commit | b2d751459b6a5c24da94782e5f267ba808901581 (patch) | |
tree | 9ab8ce8ed4957eed58a189fe2fbfe63a73546351 /distortion/utils.py | |
parent | 3129910ad6844f7ce68fde2295396f767c00f887 (diff) | |
download | stwcs_hcf-b2d751459b6a5c24da94782e5f267ba808901581.tar.gz |
Resolves #501: added an option to create an output WCS without applying the distortion model.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@8612 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'distortion/utils.py')
-rw-r--r-- | distortion/utils.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/distortion/utils.py b/distortion/utils.py index a6b4fa5..06bf5f8 100644 --- a/distortion/utils.py +++ b/distortion/utils.py @@ -1,12 +1,11 @@ -from __future__ import division # confidence high - +from __future__ import division # confidence high import numpy as np import pywcs import pyfits from stwcs import wcsutil from numpy import sqrt, arctan2 -def output_wcs(list_of_wcsobj, ref_wcs=None, outwcs=None): +def output_wcs(list_of_wcsobj, ref_wcs=None, outwcs=None, undistort=True): fra_dec = np.vstack([w.calcFootprint() for w in list_of_wcsobj]) delta_fdec = (fra_dec[:,1].max()-fra_dec[:,1].min()) @@ -19,8 +18,10 @@ def output_wcs(list_of_wcsobj, ref_wcs=None, outwcs=None): if outwcs is None: if ref_wcs == None: ref_wcs = list_of_wcsobj[0] - - outwcs = undistortWCS(ref_wcs) + if undistort: + outwcs = undistortWCS(ref_wcs) + else: + outwcs = ref_wcs.copy() outwcs.wcs.crval = crval outwcs.pscale = sqrt(outwcs.wcs.cd[0,0]**2 + outwcs.wcs.cd[1,0]**2)*3600. outwcs.orientat = arctan2(outwcs.wcs.cd[0,1],outwcs.wcs.cd[1,1]) * 180./np.pi @@ -42,6 +43,11 @@ def output_wcs(list_of_wcsobj, ref_wcs=None, outwcs=None): return outwcs def undistortWCS(wcsobj): + """ + Creates an undistorted linear WCS by applying the IDCTAB distortion model + to a 3-point square. The new ORIENTAT angle is calculated as well as the + plate scale in the undistorted frame. + """ assert isinstance(wcsobj, pywcs.WCS) import coeff_converter |