| Home | Trees | Indices | Help |
|---|
|
|
The routines in this module implement the FITS World Coordinate System (WCS) standard which defines methods to be used for computing world coordinates from image pixel coordinates, and vice versa.
Note that pixel coordinates are always given and returned with a base of zero, to be consistent with Numpy and PyFITS indexing, not base one as the FITS standard.
The basic workflow is as follows:
import pywcs
pywcs.WCS constructor with a PyFITS header
object.
fix methods on
the object.
pixel2world() or
world2pixel() methods.
Short example:
import numpy
import pywcs
import pyfits
hdulist = pyfits.open("test.fits")
# Parse the WCS keywords in the primary HDU
wcs = pywcs.WCS(hdulist[0].header)
# Print out the "name" of the WCS, as defined in the FITS header
print wcs.name
# Some interesting pixel coordinates
pixcrd = numpy.array([[0,0],[24,38],[45,98]], numpy.float_)
# Convert pixel coordinates to world coordinates
world = wcs.pixel2world(pixcrd)
print world
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Tue Feb 5 14:39:29 2008 | http://epydoc.sourceforge.net |