Skip to main content

Python tool to perform spherical harmonics expansion.

Project description


zenodo badge

PySphereX is a Python tool to perform spherical harmonics expansion of data given on a uniformly spaced grid on a sphere. Its features include:

  • Expansion class that defines an arbitrary complex spherical harmonics expansion
  • Convenience constructor Expansion.from_data that initializes Expansion object from gridded data on a sphere up to a maximum degree
  • Evaluation of Expansion object at arbitrary coordinates
  • Angular power spectrum
  • Algebraic operations: Addition, subtraction and overlap between two Expansion objects

Getting Started

Make sure that Python 3.7 or newer is available and install pyspherex using pip,

pip install pyspherex

As a "getting started guide" we provide an example (in folder examples/) that shows the basic functionalities of this package. For further information see the doc-strings and the unit tests.


Report an issue

We use the issue-tracking management system associated with the project provided by Github. If you want to report a bug or request a feature, open an issue at You may also comment on existing issues.

Development environment

We strongly recommend to use Python virtual environments.

To setup the development environment, use the following commands:

git clone
cd PySphereX
python -m venv venv
source ./venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -e .


The project's development workflow is based on the issue-tracking system provided by Github, as well as peer-reviewed pull requests. This ensures high-quality standards.

Issues are solved by creating branches and opening pull requests. Only the assignee of the related issue and pull request can push commits on the branch. Once all the changes have been pushed, the pull request can be marked as ready for review and is assigned to a reviewer. They can push new changes to the branch, or request changes to the original author by re-assigning the pull request to them. When the pull request is accepted, the branch is merged onto main, deleted, and the associated issue is closed.

Pylint and pytest

We enforce PEP 8 (Style Guide for Python Code) with Pylint syntax checking, and testing of the code via unit and integration tests with the pytest framework. Both are implemented in the continuous integration system. Only if all tests pass successfully a pull request can be merged.

You can run them locally

pylint */**.py

How to cite

If you intend to use this package in your own research please be sure to cite it. For BibTex we suggest:

    author = {Martin Staab},
    title = {PySphereX},
    howpublished = {\url{}},
    year = {2021},
    DOI={<insert DOI from Zenodo>}


Many thanks to Ulrike Proske (prosku) for providing the example script.


Project details

Release history Release notifications | RSS feed

This version


Download files

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

Source Distribution

pyspherex-1.0.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

pyspherex-1.0-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page