Installing and using ''healpy'' in Sage

healpy is a healpix python wrapper, including all its capabilities.

Notes:

Install

Requirements

The requirements of healpy which do not come bundled within Sage are:

In the first place, let us install pyfits:

  1. Download the source tarball from here.

  2. Extract it in some dummy directory and change to it.
  3.  $ bash sage --python setup.py build

  4.  $ bash sage --python setup.py install --user

If everything went fine, you should be able to do import pyfits from Sage cleanly. If that is the case, the dummy directory can be safely erased.

The next step is branching and applying #11334, following the general instructions at the Sage Developer’s Guide. After it, one should be able to import numpy cleanly inside Sage.

Actually installing healpy

  1. Download the latest snapshot (see notes at the beginning) from here.

  2. Extract it in some dummy directory and change to it.
  3. Download the latest snapshot of cfitsio and healpix from here and here, respectively, and extract the contents in the corresponding subfolders of the dummy folder; i.e. the files of cfitsio should appear under the cfitsio subfolder, without any intermediate folder and the same for healpix. To see the expected directory structure, one can explore the file tree at the healpy github.

  4.  $ bash sage --python setup.py build

  5.  $ bash sage --python setup.py install --user

If the examples in the next section work, the dummy directory can be erased.

Testing and general usage

Let us first make some general imports:

   1     sage: import numpy as np
   2     sage: import matplotlib.pyplot as plt

And, of course:

   1     sage: import healpy as hp

If the import is clean, we can start testing the examples in the healpy tutorial, noticing the following:

Plotting

All the (static) plotting functions work: mollview(), gnomview() and cartview(). But in order for Sage to show the figure, one must save it with plt.savefig(''), where plt is the name with which matplotlib.pyplot was imported.

Making the dynamic mollzoom() work is still work to do, possibly related with using an interactive matplotlib backend, as explained here.

healpy (last edited 2013-03-12 12:32:40 by JesusTorrado)