|
Size: 3140
Comment:
|
Size: 3235
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 16: | Line 16: |
| * packages (install from the system's package manager): pkg-config, autoconf, libtool, gcc, g++, python-dev | |
| Line 55: | Line 56: |
| If the import is clean, we can start testing the examples in the [[http://healpy.readthedocs.org/en/latest/tutorial.html|healpy tutorial]], having into account that inside Sage, in order to use pyplot, right before plotting we have to clean the canvas with {{{#!python plt.clf()}}}, and in order to show the figure in the notebook we do not use {{{#! plt.show()}}} but {{{#! plt.savefig('')}}}. | If the import is clean, we can start testing the examples in the [[http://healpy.readthedocs.org/en/latest/tutorial.html|healpy tutorial]], having into account that inside Sage, in order to use pyplot, right before plotting we have to clean the canvas with {{{plt.clf()}}}, and in order to show the figure in the notebook we do not use {{{plt.show()}}} but {{{plt.savefig('')}}}. |
Installing and using ''healpy'' in Sage
healpy is a healpix python wrapper, including all its capabilities.
Notes:
Using the latest snapshot of healpy is recommended, since the management of the cfitsio library is simplified w.r.t. the latest release: 1.5.0.
Right now, the latest snapshot is broken for 32 bits systems!
Unfortunately, until #11334 gets merged, the numpy version shipped with Sage is too old, so it is necessary to apply that patch manually, preferably in a branch in which we will work.
Install
Requirements
The requirements of healpy which do not come bundled within Sage are:
- packages (install from the system's package manager): pkg-config, autoconf, libtool, gcc, g++, python-dev
numpy >= 1.6 (1.5 as of Sage 5.7)
- pyfits
In the first place, let us install pyfits:
Download the source from here.
- Extract it in some dummy directory and change to it.
$ bash sage --python setup.py build
$ 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.
Actuallly installing healpy
Download the latest snapshot (see notes at the beginning) from here.
- Extract it in some dummy directory and change to it.
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; e.g. the files of cfitsio should appear under the cfitsio subfolder, without any intermediate folder. To see the expected directory structure, one can explore the file tree at the healpy github.
$ bash sage --python setup.py build
$ 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's first make some general imports:
And, of course:
1 sage: import healpy as hp
If the import is clean, we can start testing the examples in the healpy tutorial, having into account that inside Sage, in order to use pyplot, right before plotting we have to clean the canvas with plt.clf(), and in order to show the figure in the notebook we do not use plt.show() but plt.savefig('').
