Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!


Project description


pixell is a library for loading, manipulating and analyzing maps stored in rectangular pixelization. It is mainly targeted for use with maps of the sky (e.g. CMB intensity and polarization maps, stacks of 21 cm intensity maps, binned galaxy positions or shear) in cylindrical projection, but its core functionality is more general. It extends numpy’s ndarray to an ndmap class that associates a World Coordinate System (WCS) with a numpy array. It includes tools for Fourier transforms (through numpy or pyfft) and spherical harmonic transforms (through libsharp2) of such maps and tools for visualization (through the Python Image Library).


  • Python>=3.6
  • gcc/gfortran or Intel compilers (clang might not work out of the box), if compiling from source
  • libsharp2 (downloaded and installed, if compiling from source)
  • automake (for libsharp2 compilation, if compiling from source)
  • healpy, Cython, astropy, numpy, scipy, matplotlib, pyyaml, h5py, Pillow (Python Image Library)


Make sure your pip tool is up-to-date. To install pixell, run:

$ pip install pixell --user
$ test-pixell

This will install a pre-compiled binary suitable for your system (only Linux and Mac OS X with Python>=3.6 are supported). If you require more control over your installation, e.g. using your own installation of libsharp2, using Intel compilers or enabling tuning of the libsharp2 installation to your CPU, please see the section below on compiling from source. The test-pixell command will run a suite of unit tests.

Compiling from source (advanced / development workflow)

For compilation instructions specific to NERSC/cori, see NERSC.

For compilation instructions specific to Mac OS X, see MACOSX (h/t Thibaut Louis).

For all other, below are general instructions.

First, download the source distribution or git clone this repository. You can work from master or checkout one of the released version tags (see the Releases section on Github). Then change into the cloned/source directory.

Existing libsharp installation (optional)

libsharp2 is installed automatically by the you will execute below. The installation script will attempt to automatically git clone the latest version of libsharp2 and compile it. If instead you want to use an existing libsharp2 installation, you can do so by symlinking the libsharp2 directory into a directory called _deps in the root directory, such that pixell/_deps/libsharp2/build/include/libsharp2/sharp.h and pixell/_deps/libsharp2/build/lib/ exist. If you are convinced that the libsharp2 library is successfully compiled, add an empty file named pixell/_deps/libsharp2/success.txt to ensure pixell’s knows of your existing installation.


If not using Intel compilers (see below), build the package using

$ python build_ext -i

You may now test the installation:

$ py.test pixell/tests/

If the tests pass, either add the cloned directory to your $PYTHONPATH, if you want the ability for changes made to Python source files to immediately reflect in your installation, e.g., in your .bashrc file,

export PYTHONPATH=$PYTHONPATH:/path/to/cloned/pixell/directory

or alternatively, install the package

$ python install --user

which requires you to reinstall every time changes are made to any files in your repository directory.

Intel compilers

Intel compilers require you to modify the build step above as follows

$ python build_ext -i --fcompiler=intelem --compiler=intelem

On some systems, further specification might be required (make sure to get a fresh copy of the repository before trying out a new install method), e.g.:

$ LDSHARED="icc -shared" LD=icc LINKCC=icc CC=icc python build_ext -i --fcompiler=intelem --compiler=intelem


If you have write access to this repository, please:

  1. create a new branch
  2. push your changes to that branch
  3. merge or rebase to get in sync with master
  4. submit a pull request on github

If you do not have write access, create a fork of this repository and proceed as described above. For more details, see Contributing.


0.12.1 (2021-04-30)

Changes relative to 0.12.0 include:

  • Patch to fix numpy binary incompatibility issues caused by changes to the numpy C API. We now require numpy >1.20.

0.12.0 (2021-04-13)

Changes relative to 0.11.2 include:

  • We now use libsharp2 instead of libsharp, which has signficantly faster SHTs
  • Major breaking change: the meaning of the “iau” flag has been corrected and reversed. The default behaviour of map2harm and other functions using this flag will be different.
  • Unified harmonic transforms module
  • postage_stamp removed in favor of thumbnails
  • Adjoint harmonic transforms

0.11.2 (2021-02-04)

Changes relative to 0.11.0 include:

  • Bug-fix for when using rmax in distance_transform

0.11.0 (2021-02-02)

Changes relative to 0.10.3 include:

  • Bug-fix for enmap.project that led to crashes
  • enplot improvements
  • Improvements to fft and ifft overhead
  • alm filtering API improvements
  • Changes to CMB dipole parameter
  • Allow lmax!=mmax in curvedsky routines
  • Python 3.9 builds and Github actions instead of Travis

0.10.3 (2020-06-26)

Changes relative to 0.10.2 include:

  • Bug fix for automatic IAU -> COSMO, recognizes POLCCONV instead of POLCONV.

0.10.2 (2020-06-26)

Changes relative to 0.9.6 include:

  • Automatically converts maps recognized to be in IAU polarization convention (through the FITS header) to COSMO convention by flipping the sign of U
  • Fixes a centering issue in reproject.thumbnails
  • Optimizes posmap for separable projections and pixsizemap for cylindrical projections making these functions orders of magnitude faster for CAR (and other projections)
  • A test script test-pixell is distributed with the package

0.9.6 (2020-06-22)

Changes relative to 0.6.0 include:

  • Ability to read compressed FITS images
  • Fixed a bug to make aberration and modulation accurate to all orders
  • Expanded alm2cl to handle full cross-spectra and broadcasting

0.6.0 (2019-09-18)

Changes relative to 0.5.2 include:

  • Improvements in accuracy for map extent, area and Fourier wavenumbers
  • Spherical harmonic treatment consistent with healpy
  • Additional helper functions, e.g enmap.insert
  • Helper arguments, e.g. physical normalization for enmap.fft
  • Bug fixes e.g. in rand_alm
  • Improved installation procedure and documentation

0.5.2 (2019-01-22)

  • API for most modules is close to converged
  • Significant number of bug fixes and new features
  • Versioning system implemented through versioneer and bumpversion
  • Automated pixel level tests for discovering effects of low-level changes

0.1.0 (2018-06-15)

  • First release on PyPI.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pixell, version 0.12.1
Filename, size File type Python version Upload date Hashes
Filename, size pixell-0.12.1-cp36-cp36m-macosx_10_9_x86_64.whl (8.5 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pixell-0.12.1-cp36-cp36m-manylinux2010_x86_64.whl (9.7 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pixell-0.12.1-cp37-cp37m-macosx_10_9_x86_64.whl (8.5 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pixell-0.12.1-cp37-cp37m-manylinux2010_x86_64.whl (9.7 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pixell-0.12.1-cp38-cp38-macosx_10_9_x86_64.whl (8.5 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pixell-0.12.1-cp38-cp38-manylinux2010_x86_64.whl (10.1 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pixell-0.12.1-cp39-cp39-macosx_10_9_x86_64.whl (8.5 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pixell-0.12.1-cp39-cp39-manylinux2010_x86_64.whl (9.9 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pixell-0.12.1.tar.gz (6.7 MB) File type Source Python version None Upload date Hashes View

Supported by

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