Skip to main content

Python wrappers to WCSLIB

Project description


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:

Build instructions

pywcs includes its own copy of WCSLIB.

pywcs requires:

  • 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 install

to install pywcs.

Building documentation

Optionally, the documentation can be built using Sphinx (

After installing pywcs, ‘cd’ into the ‘doc’ directory and:

make html

The documentation is also available online at:

Version 1.11


  • 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.

Version 1.10

  • 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.

Version 1.9

  • 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

Version 1.3a1

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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions (2.4 MB view hashes)

Uploaded source

pywcs-1.12.tar.gz (2.0 MB view hashes)

Uploaded source

Built Distribution

pywcs-1.12-py2.7-win32.egg (467.1 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page