Previous topic

HSTWCS Examples

Next topic

UPDATEWCS

This Page

User Interface: altwcs

The functions in this module manage alternate WCS’s in a header.

stwcs.wcsutil.altwcs.archiveWCS(fname, ext, wcskey=' ', wcsname=' ', clobber=False)

Copy the primary WCS to the hader as an alternate WCS with wcskey and name WCSNAME. It loops over all extensions in ‘ext’

Parameters :
 

fname: string or pyfits.HDUList :

a file name or a file object

ext: an int, a tuple, a python list of integers or a python list of tuples (e.g.(‘sci’,1)) :

fits extensions to work with

wcskey: string “A”-“Z” or ” “ :

if ” ”: get next available key if wcsname is also ” ” or try to get a key from WCSNAME value

wcsname: string :

Name of alternate WCS description

clobber: boolean :

if Ture - overwrites a WCS with the same key

See also

wcsutils.restoreWCS
Copy an alternate WCS to the primary WCS
stwcs.wcsutil.altwcs.restoreWCS(f, ext, wcskey=' ', wcsname=' ', clobber=False)

Copy a WCS with key “WCSKEY” to a primary WCS

Reads in a WCS defined with wcskey and saves it as the primary WCS. If clobber is False, writes out new files whose names are the original names with an attached 3 character string _’WCSKEY’_. Otherwise overwrites the files. Goes sequentially through the list of extensions The WCS is restored from the ‘SCI’ extension but the primary WCS of all extensions with the same EXTVER are updated.

Parameters :
 

f: string or pyfits.HDUList object :

a file name or a file object

ext: an int, a tuple, a python list of integers or a python list :

of tuples (e.g.(‘sci’,1)) fits extensions to work with

wcskey: a charater :

“A”-“Z” - Used for one of 26 alternate WCS definitions. or ” ” - find a key from WCSNAMe value

wcsname: string (optional) :

if given and wcskey is ” ”, will try to restore by WCSNAME value

clobber: boolean :

A flag to define if the original files should be overwritten

See also

wcsutil.archiveWCS

stwcs.wcsutil.altwcs.deleteWCS(fname, ext, wcskey=' ', wcsname=' ')

Delete an alternate WCS defined with wcskey. If wcskey is ” ” try to get a key from WCSNAME.

Parameters :
 

fname: sting or a pyfits.HDUList object :

ext: an int, a tuple, a python list of integers or a python list of tuples (e.g.(‘sci’,1)) :

fits extensions to work with

wcskey: one of ‘A’-‘Z’ or ” “ :

wcsname: string :

Name of alternate WCS description

stwcs.wcsutil.altwcs.wcsnames(header)

Returns a dictionary of wcskey: WCSNAME pairs

Parameters :
 header: pyfits.Header :
stwcs.wcsutil.altwcs.wcskeys(header)

Returns a list of characters used in the header for alternate WCS description with WCSNAME keyword

Parameters :
 hdr: pyfits.Header :
stwcs.wcsutil.altwcs.available_wcskeys(header)

Returns a list of characters which are not used in the header with WCSNAME keyword. Any of them can be used to save a new WCS.

Parameters :
 header: pyfits.Header :
stwcs.wcsutil.altwcs.next_wcskey(header)

Returns next available character to be used for an alternate WCS

Parameters :
 header: pyfits.Header :
stwcs.wcsutil.altwcs.getKeyFromName(header, wcsname)

If WCSNAME is found in header, return its key, else return None. This is used to update an alternate WCS repeatedly and not generate new keys every time.

Parameters :
 

header: pyfits.Header :

wcsname: str :

Value of WCSNAME