A Python wrapper for the libsharp library
The libsharp-wrapper is a Python wrapper for the C-library libsharp. It is written in Cython and C++. The functional layout is inspired by healpy.
The wrapper provides access to the spherical harmonics transformation of the Gauss-Legendre pixelization. An extension to all pixelizations supported by libsharp would be feasible.
Spherical harmonics transformations from and to the Gauss-Legendre pixelization:
alm2map() map2alm() alm2map_f() map2alm_f()
Support for NumPy arrays in double and float precision (functions operating on floats are suffixed by
_f
)Power spectrum analysis and field synthesis (assuming statistically homogeneous and isotropic random fields):
anaalm() anafast() synalm() synfast() anaalm_f() anafast_f() synalm_f() synfast_f()
Smoothing with Gaussian kernel:
smoothalm() smoothmap()
Support functions for pixelization issues:
bounds() weight() vol() weight_f()
Support functions for geometrical quantities and indices:
ang2pix() ang2xyz() pix2xyz() lm2i() pix2ang() xyz2ang() xyz2pix() i2lm() pix2nn()
Non-trivial scalar product in spherical harmonics basis:
dotlm() dotlm_f()
... for libsharp
- GNU make
- GNU gcc (v4.x)
- GNU autoconf
- git
... for libsharp-wrapper
- Cython (v0.1x)
- Python (v2.7.x)
- Python Development Tools
- Numpy
- Numpy Development Tools
... of libsharp
git clone git://git.code.sf.net/p/libsharp/code libsharp-code cd libsharp-code autoconf configure --enable-pic --disable-openmp make cd ..
... of libsharp-wrapper
git clone git://github.com/mselig/libsharp-wrapper.git libsharp-wrapper cd libsharp-wrapper python setup.py build_ext
python setup.py install
Alternatively, a private or user specific installation can be done by:
python setup.py install --user python setup.py install --install-lib=/SOMEWHERE
In Python run:
>>> import numpy as np >>> import libsharp_wrapper_gl as gl >>> gl.map2alm(np.ones(28), nlat=4, nlon=7, lmax=3, mmax=3)[0]**2 # == 4 pi (12.566370614359174+0j)
The libsharp-wrapper is licensed under the GPLv2 and is distributed without any warranty.
The current version is tagged v0.2.0 and is available as a source package at https://github.com/mselig/libsharp-wrapper/tags.