pixtosky: Coordinate transformation to sky coordinates — drizzlepac 1.0.6 (14-Aug-2012) documentation

### Navigation

- index
- modules |
- next |
- previous |
- drizzlepac 1.0.6 (14-Aug-2012) documentation »

# pixtosky: Coordinate transformation to sky coordinates

This task allows a user to perform coordinate transformations with the full WCS and distortion model on source positions from an input image to sky coordinates. This task serves as a replacement for the IRAF.STSDAS task ‘xy2rd’, albeit with the added capability of understanding the full distortion model provided in the headers of images updated for use with astrodrizzle and tweakreg.

pixtosky - A module to perform coordinate transformation from pixel to sky coordinates.

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

## PARAMETERS

input : str
  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

x : float, optional
  X position from input image
y : float, optional
  Y position from input image
coords : str, optional
  full filename with path of file with x,y coordinates
colnames : str, optional
  comma separated list of column names from ‘coords’ files containing x,y coordinates, respectively. Will default to first two columns if None are specified. Column names for ASCII files will use ‘c1’,’c2’,... convention.
separator : str, optional
  non-blank separator used as the column delimiter in the coords file
hms : bool, optional
  Produce output in HH:MM:SS.S format instead of decimal degrees? (default: False)
precision : int, optional
  Number of floating-point digits in output values
output : str, optional
  Name of output file with results, if desired
verbose : bool
  Print out full list of transformation results (default: False)

## RETURNS

ra : float
  Right Ascension of pixel. If more than 1 input value, then it will be a numpy array.
dec : float
  Declination of pixel. If more than 1 input value, then it will be a numpy array.

## NOTES

This module performs a full distortion-corrected coordinate transformation based on all WCS keywords and any recognized distortion keywords from the input image header.

## Usage

It can be called from within Python using the syntax:

    >>> from drizzlepac import pixtosky
    >>> r,d = pixtosky.xy2rd("input_flt.fits[sci,1]",100,100)

## EXAMPLES

1. The following command will transform the position 256,256 into a

     position on the sky for the image ‘input_flt.fits[sci,1]’ using:

         >>> from drizzlepac import pixtosky
         >>> r,d = pixtosky.xy2rd("input_file_flt.fits[sci,1]", 256,256)

2. The set of X,Y positions from ‘input_flt.fits[sci,1]’ stored as

     the 3rd and 4th columns from the ASCII file ‘xy_sci1.dat’ will be transformed and written out to ‘radec_sci1.dat’ using:

         >>> from drizzlepac import pixtosky
         >>> r,d = pixtosky.xy2rd("input_flt.fits[sci,1]", coords='xy_sci1.dat',
             colnames=['c3','c4'], output="radec_sci1.dat")

`drizzlepac.pixtosky.` `xy2rd`(input, x=None, y=None, coords=None, colnames=None, separator=None, hms=True, precision=6, output=None, verbose=True)

  Primary interface to perform coordinate transformations from pixel to sky coordinates using STWCS and full distortion models read from the input image header.

### Navigation

- index
- modules |
- next |
- previous |
- drizzlepac 1.0.6 (14-Aug-2012) documentation »