skytopix: Coordinate transformation from sky coordinates
This task allows a user to perform coordinate transformations
with the full WCS and distortion model on source positions
from sky coordinates to the WCS defined by an image.
This task serves as a replacement for
the IRAF.STSDAS
task rd2xy
, albeit with the
added capability of understanding the full distortion model
provided in the headers of images updated for use with astrodrizzle and
tweakreg.
skytopix
transforms source positions given as RA, Dec values into
pixel positions on the image based on the WCS information and any recognized
distortion keywords contained in the input image header.
- Authors:
Warren Hack
- License:
Parameters
- inputstr
full filename with path of input image, an extension name [‘sci’,1] should be provided if input is a multi-extension FITS file.
Optional Parameters
- rastring, optional
RA position in either decimal degrees or HMS format (with or without
':'
) like'19:10:50.337406303'
or'19 10 50.337406303'
- decstring, optional
Dec position in either decimal degrees or HMS format (with or without
':'
) like'-60:2:22.186557409'
or'-60 2 22.186557409'
- coordfilestr, optional
full filename with path of file with sky coordinates
- colnamesstr, optional
comma separated list of column names from ‘coordfile’ file containing sky coordinates, respectively. Will default to first two columns if None are specified. Column names for ASCII files will use ‘c1’,’c2’,… convention.
- precisionint, optional
Number of floating-point digits in output values
- outputstr, optional
Name of output file with results, if desired
- verbosebool
Print out full list of transformation results (default:
False
)
Returns
- xfloat
X position of pixel. If more than 1 input value, then it will be a numpy array.
- yfloat
Y position of pixel. If more than 1 input value, then it will be a numpy array.
Notes
This task performs a full distortion-correction coordinate transformation
based on all WCS keywords and any recognized distortion keywords from the
input image header. The transformation recognizes the conventions for
describing distortion implemented as part of the SIP and Paper IV conventions
used with AstroDrizzle
. Input images can be updated to use these conventions
through the use of the updatewcs
module the STWCS package.
See Also
Examples
These examples illustrate the syntax that can be used to run the task in a couple of common modes.
- Convert a single sky position (0:22:07.0088,-72:03:05.429)
from a calibrated ACS image (j94f05bgq_flt.fits) into a pixel position (X,Y) without using the TEAL GUI:
>>> from drizzlepac import skytopix
>>> x,y = skytopix.rd2xy("j8bt06nyq_flt.fits[sci,1]",
... '0:22:07.0088', '-72:03:05.429')
- Convert a list of (undistorted) sky positions from the file,
- ‘radec.dat’ for a calibrated ACS image (j8bt06nyq_flt.fits)
into distorted pixel positions, and write out the result to the file ‘xypos.dat’ without using the TEAL GUI:
>>> x,y = skytopix.rd2xy("j8bt06nyq_flt.fits[sci,1]",
... coordfile="radec.dat", output="xypos.dat")
- drizzlepac.skytopix.rd2xy(input, ra=None, dec=None, coordfile=None, colnames=None, precision=6, output=None, verbose=True)[source]
Primary interface to perform coordinate transformations from pixel to sky coordinates using STWCS and full distortion models read from the input image header.
- drizzlepac.skytopix.help(file=None)
Print out syntax help for running
skytopix
.- Parameters:
- filestr (Default = None)
If given, write out help to the filename specified by this parameter Any previously existing file with this name will be deleted before writing out the help.