Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Drizzlib is a drizzling module to convert from HEALPIX to WCS FITS files.

Project description


This is a [HEALPIx] to [WCS] FITS conversion python package.
You can extract a rectangular subset of the [HEALPIx] image into the [WCS]
format with the frame, projection and resolution of your choosing.

It has only been tested with python `2.6` and `2.7`.




`drizzlib` requires the python packages `numpy`, `astropy`, and `healpy`.
Those dependencies are listed in `requirements.txt`.

You can install them easily with [pip] (Pip Installs Packages) :

$ pip install --upgrade setuptools
$ pip install -r requirements.txt

or, as a user, if you're not root or in a virtual env :

$ pip install --upgrade --user setuptools
$ pip install --user -r requirements.txt

As you can see, we need to upgrade `setuptools` to at least `14.3.1` _first_.
This is because `healpy` requires it, and pip internally uses `setuptools` too.


Simply run :

$ python install

You might need to be superuser for it to work if you are not in a
virtualenv :

$ sudo python install

or, as a simple user :

$ python install --user


- `The following required packages can not be built: freetype, png`
Older versions of healpy require old matplotlib that requires freetype :
`sudo apt-get install pkg-config libfreetype*`

- `fatal error: Python.h`
You need python's development packages, too :
`sudo apt-get install python-dev`

- `no lapack/blas resources found`
On Debian-based systems, install the following system packages :
`sudo apt-get install gfortran libopenblas-dev liblapack-dev`

- `UnicodeEncodeError`
Make sure the directory in which you uncompressed drizzlib does not contain
non-ascii characters in its path.


As a library

See `doc/` for a more extensive example.

``` python
from drizzlib import healpix2wcs

# Reads `my_healpix.fits`, extracts a subset of its data described by the
# header in `wcs_config.fits`, and writes the result into `my_wcs.fits`.
healpix2wcs('my_healpix.fits', header='wcs_config.fits', output='my_wcs.fits')

As a binary

In the shell, run :

$ bin/healpix2wcs -h

or, if you installed the package, simply :

$ healpix2wcs -h

It will show you how to use it, which is like this:

$ healpix2wcs [-h] [-f] <healpix> <header> <out>


Bump the `VERSION`, and then run :

$ python sdist

It will create a source distribution tarball in the `dist` directory.
It uses `` to exclude files we want to exclude.

Packaging on Pypi

pip install -U "pip>=1.4" "setuptools>=0.9" "wheel>=0.21" twine
python sdist
twine upload dist/drizzlib-*

In your ``~/.pypirc` :


repository =
username = <username>
password = <password>



We use [semantic versioning](

Code formatting

We follow [PEP 8](


Write your documentation in



- Fix the source distribution.


- Initial release of `healpix2wcs`.
- Fix all of the bugs©.


- Basic `wcs2healpix`.


- Add a `healpix2wcs` executable.
- [healpix2wcs] Fix some more bugs.
- [healpix2wcs] Ignore `BLANK` values in input HEALPix.


- Embark a Sutherland-Hodgman clipping algorithm written in C, to optimize further.


- Optimize a lot thanks to the `line_profiler`.


- [healpix2wcs] Initial project skeleton files.
- [healpix2wcs] Non-optimized conversion using `healpy`.


Related Papers

TODO: @Deborah, reference your paper(s) here.


Learn more about the awesome HEALPix pixelation here :


Learn more about [drizzling].

Here are some polygon clipping algorithms:

- We're using:
- Faster:
- Even faster :


Python 3.4

Notes taken while trying with python 3.4.

Debian packages : python3.4 python3.4-dev virtualenv python-virtualenv

cd drizzlib
virtualenv -p /usr/bin/python3.4 venv3.4
source venv3.4/bin/activate

# Now we're in virtualenv

# Annoying that we MUST do that first
# It might mess with our integration in pypi
pip install setuptools --upgrade

pip install -r requirements.txt

Also, I had to soft link the generated so file from where it was to the project root :

ln -s build/lib.linux-x86_64-3.4/

The install should do this, but in a virtualenv... YMMV.

Project details

Download files

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

Files for drizzlib, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size drizzlib-1.0.2.tar.gz (23.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page