xy2rd
- drizzlepac.pixtosky.xy2rd(input, x=None, y=None, coords=None, coordfile=None, colnames=None, separator=None, hms=True, 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.
- 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
- xfloat or list or array, optional
X position from input image for a single or multiple sources
- yfloat or list or array, optional
Y position from input image for a single or multiple sources
- coordsstr, deprecated
[DEPRECATED] full filename with path of file with x,y coordinates Filename given here will be ignored if a file has been specified in
coordfileparameter.- coordfilestr, optional
Full filename with path of file with x,y coordinates
- colnamesstr, optional
Comma separated list of column names or list of column name strings from ‘coordfile’ files containing x,y coordinates, respectively. This parameter will default to first two columns if None are specified. Column names for ASCII files will use ‘c1’,’c2’,… convention. Valid syntax: [‘c1’,’c3’] or ‘c1,c3’
- separatorstr, optional
Non-blank separator used as the column delimiter in the coordfile file
- hmsbool, optional
Produce output in HH:MM:SS.S format instead of decimal degrees? (default: False)
- 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:
- rafloat or array
Right Ascension of pixel. If more than 1 input value, then it will be a numpy array.
- decfloat or array
Declination 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 updatewcs module in the STWCS package. Refer to the STWCS documentation (https://stwcs.readthedocs.io/en/latest/) for an overview of the WCS-based transformation utilities relied upon here.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]", coordfile='xy_sci1.dat', ... colnames=['c3','c4'], output="radec_sci1.dat")