Previous topic

WCSUTIL

Next topic

Conversion Utilities

This Page

MAKEWCS

MAKEWCS.PY - Updated the WCS in an image header so that
it matches the geometric distortion defined in an IDC table which is referenced in the image header.

License: http://www.stsci.edu/resources/software_hardware/pyraf/LICENSE

This version tries to implement a full updating of the WCS based on information about the V2/V3 plane which is obtained from th IDCTAB and, in the case of WFPC2, the OFFTAB.

The only parameters from the original WCS which are retained are the CRVALs of the reference chip.

The original WCS are first copied to MCD1_1 etc before being updated.

UPINCD History:
 

First try, Richard Hook, ST-ECF/STScI, August 2002. Version 0.0.1 (WJH) - Obtain IDCTAB using PyDrizzle function. Version 0.1 (WJH) - Added support for processing image lists.

Revised to base CD matrix on ORIENTAT, instead of PA_V3 Supports subarrays by shifting coefficients as needed.
Version 0.2 (WJH) - Implemented orientation computation based on PA_V3 using
Troll function from Colin to compute new ORIENTAT value.
Version 0.3 (WJH) - Supported filter dependent distortion models in IDCTAB
fixed bugs in applying Troll function to WCS.
Version 0.4 (WJH) - Updated to support use of ‘defaultModel’ for generic
cases: XREF/YREF defaults to image center and idctab name defaults to None.
Version 0.5 (WJH) - Added support for WFPC2 OFFTAB updates, which updates
the CRVALs. However, for WFPC2 data, the creation of the backup values does not currently work.
MAKEWCS History:
 
MAKEWCS V0.0 (RNH) - Created new version to implement more complete
WCS creation based on a reference tangent plane.

V0.1 (RNH) - First working version for tests. May 20th 2004. V0.11 (RNH) - changed reference chip for ACS/WFC. May 26th 2004. V0.2 (WJH) - Removed all dependencies from IRAF and use new WCSObject

class for all WCS operations.

V0.4 (WJH/CJH) - Corrected logic for looping of extension in FITS image. V0.5 (RNH) - Chip to chip CRVAL shifting logic change. V0.6 (CJH/WJH) - Added support for non-associated STIS data. V0.6.2 (WJH) - Added support for NICMOS data. This required

new versions of wcsutil and fileutil in PyDrizzle.
V0.6.3 (WJH) - Modified to support new version of WCSUtil which correctly
sets up and uses archived WCS keywords.
V0.7.0 (WJH) - Revised algorithm to work properly with subarray images.
Also, simplified keyword access using PyFITS object.
V0.8.0 (CJH) - Modified to work with either numarray or numpy through
the use of the numerix interface layer.
pytools.makewcs.diff_angles(a, b)

Perform angle subtraction a-b taking into account small-angle differences across 360degree line.

pytools.makewcs.getNrefchip(image, instrument='WFPC2')

This handles the fact that WFPC2 subarray observations may not include chip 3 which is the default reference chip for full observations. Also for subarrays chip 3 may not be the third extension in a MEF file. It is a kludge but this whole module is one big kludge. ND

pytools.makewcs.get_numsci(image)

Find the number of SCI extensions in the image. Input:

image - name of single input image
pytools.makewcs.help()
pytools.makewcs.readKeyword(hdr, keyword)
pytools.makewcs.restoreCD(image, prepend)
pytools.makewcs.run(input, quiet=True, restore=False, prepend='O', tddcorr=True)
makewcs - a task for updating an image header WCS to make
it consistent with the distortion model and velocity aberration.

This task will read in a distortion model from the IDCTAB and generate a new WCS matrix based on the value of ORIENTAT. It will support subarrays by shifting the distortion coefficients to image reference position before applying them to create the new WCS, including velocity aberration. Original WCS values will be moved to an O* keywords (OCD1_1,...). Currently, this task will only support ACS and WFPC2 observations.

Parameters :
 

input: str :

The filename(s) of image(s) to be updated given either as:
  • a single image with extension specified,
  • a substring common to all desired image names,
  • a wildcarded filename
  • '@file‘ where file is a file containing a list of images

quiet: bool :

turns off ALL reporting messages: ‘yes’ or ‘no’(default)

prepend: char :

This parameter specifies what prefix letter should be used to create a new set of WCS keywords for recording the original values [Default: ‘O’]

restore: bool :

restore WCS for all input images to defaults if possible: ‘yes’ or ‘no’(default)

tddcorr: bool :

applies the time-dependent skew terms to the SIP coefficients written out to the header: ‘yes’ or True or, ‘no’ or False (default).

Notes

This function can be run using the syntax:
makewcs.run(image,quiet=no,prepend=’O’,restore=no,tddcorr=True)

An example of how this can be used is given as:

>>> import makewcs
>>> makewcs.run('raw') # This will update all _raw files in directory
>>> makewcs.run('j8gl03igq_raw.fits[sci,1]')
pytools.makewcs.shift_coeffs(cx, cy, xs, ys, norder)

Shift reference position of coefficients to new center where (xs,ys) = old-reference-position - subarray/image center. This will support creating coeffs files for drizzle which will be applied relative to the center of the image, rather than relative to the reference position of the chip.

Derived directly from PyDrizzle V3.3d.