https://github.com/astro-informatics/s2wav

Differentiable and accelerated wavelet transform on the sphere with JAX

https://github.com/astro-informatics/s2wav

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    3 of 6 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.1%) to scientific vocabulary

Keywords

dictionary differentiable-programming jax sphere spherical-harmonics wavelet-transform

Keywords from Contributors

fourier-transform recursion-algorithm spherical wigner-d-matrix wigner-transform degoogle
Last synced: 5 months ago · JSON representation

Repository

Differentiable and accelerated wavelet transform on the sphere with JAX

Basic Info
Statistics
  • Stars: 22
  • Watchers: 3
  • Forks: 0
  • Open Issues: 17
  • Releases: 1
Topics
dictionary differentiable-programming jax sphere spherical-harmonics wavelet-transform
Created almost 4 years ago · Last pushed 9 months ago
Metadata Files
Readme

README.md

image image image image image <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> All Contributors <!-- ALL-CONTRIBUTORS-BADGE:END --> Open In Colab

Differentiable and accelerated wavelet transform on the sphere

S2WAV is a python package for computing wavelet transforms on the sphere and rotation group, both in JAX and PyTorch. It leverages autodiff to provide differentiable transforms, which are also deployable on modern hardware accelerators (e.g. GPUs and TPUs), and can be mapped across multiple accelerators.

More specifically, S2WAV provides support for scale-discretised wavelet transforms on the sphere and rotation group (for both real and complex signals), with support for adjoints where needed, and comes with a variety of different optimisations (e.g. precompute or not, multi-resolution algorithms) that one may select depending on available resources and desired angular resolution $L$. S2WAV is a sister package of S2FFT, both of which are part of the SAX project, which aims to provide comprehensive support for differentiable transforms on the sphere and rotation group.

[!TIP] As of version 1.0.0 S2WAV also provides partial frontend support for PyTorch. In future this will be expanded to full support. Also note that this release also provides JAX support for existing C spherical harmonic libraries, specifically SSHT. This works be wrapping python bindings with custom JAX frontends. Note that currently this C to JAX interoperability is limited to CPU.

Wavelet Transform :zap:

S2WAV is an updated implementation of the scale-discretised wavelet transform on the sphere, which builds upon the papers of Leistedt et al 2013 and McEwen et al 2017. This wavelet transform is designed to have excellent localisation and uncorrelation properties, and has been successfully adopted for various applications e.g. scattering transforms on the sphere McEwen et al 2022. The wavelet dictionary is constructed by tiling the harmonic line with infinitely differentiable Cauchy-Schwartz functions, which can straightforwardly be performed in an efficient multiresolution manner, as in the Euclidean case. This is what the directional wavelet filters look like in pixel space.

Installation :computer:

The Python dependencies for the S2WAV package are listed in the file requirements/requirements-core.txt and will be automatically installed into the active python environment by pip when running

bash pip install s2wav This will install the core functionality which includes JAX support (including PyTorch support).

Alternatively, the S2WAV package may be installed directly from GitHub by cloning this repository and then running

bash pip install .

from the root directory.

Unit tests can then be executed to ensure the installation was successful by first installing the test requirements and then running pytest

bash pip install -r requirements/requirements-tests.txt pytest tests/

Documentation for the released version is available here. To build the documentation locally run

bash pip install -r requirements/requirements-docs.txt cd docs make html open _build/html/index.html

Usage :rocket:

To import and use S2WAV is as simple follows:

``` python

Compute wavelet coefficients

fwav, fscal = s2wav.analysis(f, L, N)

Map back to signal on the sphere

f = s2wav.synthesis(fwav, fscal, L, N) ```

[!NOTE]
However we strongly recommend that the multiresolution argument is set to true, as this will accelerate the transform by a factor of the total number of wavelet scales, which can be around an order of magnitude.

C JAX Frontends for SSHT :bulb:

S2WAV also provides JAX support for SSHT, which is a highly optimised C library which implements the underlying spherical harmonic transforms. This works by wrapping python bindings with custom JAX frontends. Note that this C to JAX interoperability is currently limited to CPU.

For example, one may call these alternate backends for the spherical wavelet transform by:

``` python

Compute wavelet coefficients using SSHT C library backend

fwav, fscal = s2wav.analysis(f, L, N, usecbackend=True)

Map back to signal on the sphere using SSHT C library backend

f = s2wav.synthesis(fwav, fscal, L, N, usecbackend=True) ``` These JAX frontends supports out of the box reverse mode automatic differentiation, and under the hood is simply linking to the C packages you are familiar with. In this way S2fft enhances existing packages with gradient functionality for modern scientific computing or machine learning applications!

For further details on usage see the associated notebooks.

Contributors ✨

We strongly encourage contributions from any interested developers; a simple example would be adding support for new wavelet filters e.g. spherical needlets Chan et al 2016 or spherical ridgelets McEwen & Price 2020! Thanks goes to these wonderful people (emoji key):

Matt Price
Matt Price

💻 👀 📖 🎨
Jason McEwen
Jason McEwen

👀 🎨
Alicja Polanska
Alicja Polanska

💻 👀
Jessica Whitney
Jessica Whitney

💻 👀

Attribution

A BibTeX entry for S2WAV is:

@article{price:s2wav, author = {Matthew A. Price and Alicja Polanska and Jessica Whitney and Jason D. McEwen}, title = {"Differentiable and accelerated directional wavelet transform on the sphere and ball"}, eprint = {arXiv:2402.01282}, year = {2024} }

we also request that you cite the following paper

@article{price:s2fft, author = "Matthew A. Price and Jason D. McEwen", title = "Differentiable and accelerated spherical harmonic and Wigner transforms", journal = "Journal of Computational Physics, submitted", year = "2023", eprint = "arXiv:2311.14670" }

in which the core underlying algorithms for the spherical harmonic and Wigner transforms are developed.

License :memo:

Copyright 2024 Matthew Price, Jessica Whtiney, Alicja Polanska, Jason McEwen and contributors.

S2WAV is free software made available under the MIT License. For details see the LICENSE file.

Owner

  • Name: AstroInfo Team @ UCL
  • Login: astro-informatics
  • Kind: organization
  • Location: United Kingdom

GitHub Events

Total
  • Issues event: 2
  • Watch event: 6
  • Issue comment event: 2
  • Push event: 1
Last Year
  • Issues event: 2
  • Watch event: 6
  • Issue comment event: 2
  • Push event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 212
  • Total Committers: 6
  • Avg Commits per committer: 35.333
  • Development Distribution Score (DDS): 0.429
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
CosmoMatt m****e@h****k 121
Jessica Whitney j****2@u****k 43
alicjapolanska a****2@u****k 33
allcontributors[bot] 4****] 12
Jason McEwen j****n@g****m 2
Alicja Polanska a****a@e****k 1
Committer Domains (Top 20 + Academic)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 23 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 2
pypi.org: s2wav

Differentiable and accelerated wavelet transforms with JAX

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 23 Last month
Rankings
Dependent packages count: 9.6%
Average: 36.4%
Dependent repos count: 63.2%
Maintainers (2)
Last synced: 6 months ago

Dependencies

.github/workflows/docs.yml actions
  • JamesIves/github-pages-deploy-action 4.1.5 composite
  • actions/checkout v2.3.1 composite
  • actions/setup-python v2 composite
.github/workflows/tests.yml actions
  • actions/checkout v2.3.1 composite
  • actions/setup-python v2 composite
requirements/requirements-core.txt pypi
  • colorlog *
  • numpy *
  • pyssht *
  • pyyaml *
  • scipy *
  • so3 *
requirements/requirements-docs.txt pypi
  • ipython ==7.16.1
  • jupyter ==1.0.0
  • nbsphinx-link ==1.3.0
  • pydata-sphinx-theme ==0.12.0
  • sphinx ==4.2.0
  • sphinx-git ==11.0.0
  • sphinx-tabs ==3.2.0
  • sphinx_toolbox ==2.15.0
  • sphinxcontrib-bibtex ==2.4.1
  • sphinxcontrib-texfigure ==0.1.3
requirements/requirements-tests.txt pypi
  • black * test
  • codecov * test
  • ipython ==7.16.1 test
  • jupyter ==1.0.0 test
  • pys2let * test
  • pytest * test
  • pytest-black * test
  • pytest-cov * test
setup.py pypi