Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

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

Project description

DRIZZLIB
========

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

[HEALPIx]: http://healpix.jpl.nasa.gov
[WCS]: http://fits.gsfc.nasa.gov/fits_wcs.html
[drizzling]: http://en.wikipedia.org/wiki/Drizzle_(image_processing)
[pip]: http://www.pip-installer.org


HOW TO INSTALL
==============

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.


Install
-------

Simply run :

```
$ python setup.py install
```

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

```
$ sudo python setup.py install
```

or, as a simple user :

```
$ python setup.py install --user
```


Troubleshooting
---------------

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


HOW TO USE
==========

As a library
------------

See `doc/TUTORIAL.md` 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>
```

HOW TO DISTRIBUTE
=================

Bump the `VERSION`, and then run :

```
$ python setupy.py sdist
```

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

Packaging on Pypi
-----------------

pip install -U "pip>=1.4" "setuptools>=0.9" "wheel>=0.21" twine




GUIDELINES
==========

Versioning
----------

We use [semantic versioning](http://semver.org/).

Code formatting
---------------

We follow [PEP 8](https://www.python.org/dev/peps/pep-0008/).

Documentation
-------------

Write your documentation in
[Markdown](https://daringfireball.net/projects/markdown/).


CHANGELOG
=========

1.0.1
-----

- Fix the source distribution.


1.0.0
-----

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


0.5.0
-----

- Basic `wcs2healpix`.


0.4.0
-----

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


0.3.0
-----

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


0.2.0
-----

- Optimize a lot thanks to the `line_profiler`.


0.1.0
-----

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


THE SCIENCE
===========

Related Papers
--------------

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


Healpix
-------

Learn more about the awesome HEALPix pixelation here :
http://healpix.sourceforge.net/


Drizzling
---------

Learn more about [drizzling].

Here are some polygon clipping algorithms:

- We're using: http://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm
- Faster: http://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm
- Even faster : http://en.wikipedia.org/wiki/Liang%E2%80%93Barsky_algorithm



BLACKBOARD
==========

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/optimized.cpython-34m.so optimized.so

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.

Filename, size & hash SHA256 hash help File type Python version Upload date
drizzlib-1.0.1.tar.gz (23.4 kB) Copy SHA256 hash SHA256 Source None Jun 6, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page