Skip to main content

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`.
It should work with python `3.5`, but it has not been tested.



Using pip

This is the simplest way to install `drizzlib` if you do not want to edit its
source and just use it as-is.

pip install numpy
pip install drizzlib

You need to install `numpy` first because we're linking to some of its C
extensions _during_ the setup of drizzlib.
If you know of a way to avoid this, please tell us how.

Using the tarball

### Dependencies

`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.
This may not hold true with future versions of healpy if they get patched.

### Install

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

### Install for development

You can use pip to install the package and yet keep it editable :

$ pip install --editable .


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



We use [semantic versioning](

Code formatting

We follow [PEP 8](


Write your documentation in



- Set up python 3 compatibility. (hopefully)
- Add an `is_sigma` parameter for noise maps in `healpix2wcs`.


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

Source Distribution

drizzlib-1.2.0.tar.gz (24.0 kB view hashes)

Uploaded source

Supported by

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