Python wrappers to WCSLIB
pywcs is a set of routines for handling the FITS World Coordinate System (WCS) standard. It is a thin wrapper around the high- and mid-level interfaces of Dr. Mark Calabretta’s WCSLIB available here:
In addition, there are extensions (written in C) to support Spitzer Simple Imaging Polynomial (SIP) convention keywords and Paper IV table lookup distortion.
Please direct any questions to:
pywcs includes its own copy of WCSLIB.
Numpy 1.3 or later
pyfits 1.4 or later
pywcs uses the standard Python distutils system to build and install itself. From the command line run:
python setup.py install
to install pywcs.
Optionally, the documentation can be built using Sphinx (http://sphinx.pocoo.org).
After installing pywcs, ‘cd’ into the ‘doc’ directory and:
The documentation is also available online at:
Updated to wcslib version 4.8.2, which gives much more detailed error messages. Exceptions raised due to invalid WCS keywords should now be more informative.
Undefined values that are the result of p2s and s2p are now set to NaN. Previously, one had to examine the stat result vector to determine which results were invalid.
Added functions get_pc() and get_cdelt(). These provide a way to always get the canonical representation of the linear transformation matrix, whether the header specified it in PC, CD or CROTA form.
Supports Python 3.x
Long-running process will now release the Python GIL to better support Python multithreading.
Builds on Microsoft Windows using mingw32, mingw64 and Visual Studio 9.0 and 10.0 without severely patching wcslib.
pywcs will now run without pyfits, though the SIP and distortion lookup table functionality is unavailable.
The dimensions of the cd and pc matrices were formerly always returned as 2x2. They now are sized according to naxis.
Lots of new unit tests
Setting wcs.wcs.cunit will now verify that the values are valid unit strings.
Adds a UnitConversion class, which gives access to wcslib’s unit conversion functionality. Given two convertible unit strings, pywcs can convert arrays of values from one to the other.
Now uses wcslib 4.7
Changes to some wcs values would not always calculate secondary values.
Support binary image arrays and pixel list format WCS by presenting a way to call wcslib’s wcsbth()
Updated underlying wcslib to version 4.5, which fixes the following:
Fixed the interpretation of VELREF when translating AIPS-convention spectral types. Such translation is now handled by a new special- purpose function, spcaips(). The wcsprm struct has been augmented with an entry for velref which is filled by wcspih() and wcsbth(). Previously, selection by VELREF of the radio or optical velocity convention for type VELO was not properly handled.
The “pc” member is now available with a default “raw” Wcsprm object.
Make properties that return arrays read-only, since modifying a (mutable) array could result in secondary values not being recomputed based on those changes.
float properties can now be set using int values
Earlier versions of pywcs had two versions of every conversion method:
X(…) – treats the origin of pixel coordinates at (0, 0) X_fits(…) – treats the origin of pixel coordinates at (1, 1)
From version 1.3 onwards, there is only one method for each conversion, with an ‘origin’ argument:
0: places the origin at (0, 0), which is the C/Numpy convention.
1: places the origin at (1, 1), which is the Fortran/FITS convention.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.