Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Follow publication

Differentiable and Accelerated Spherical Harmonic Transforms

7 min readMar 14, 2024

--

Photo by Szilvia Basso on Unsplash
Examples of the most widely known cases of spherical data, such as the Earth (left) and artist impression of astronomical observations (right). [Earth image sourced from Wikipedia; astrophysics image sourced from Wikipedia.]
Diffusion tensor imaging of neuronal connections in the human brain. Within each voxel neurons are free to travel in any direction, so the problem is naturally spherical. [Animation by Alfred Anwander, CC-BY licence.]

Fourier meets Legendre

Joseph Fourier (left) and Adrien-Marie Legendre (right). Tragically, the caricature of Legendre is the only known image of him. [Fourier image sourced from Wikipedia. Legendre image sourced from Wikipedia.]
Spherical harmonic basis functions (real component). [Sourced from Wikipedia.]

The importance of being differentiable

A software package named S2FFT

S2FFT is a Python package implementing differentiable and accelerated spherical harmonic transforms, with interfaces in JAX and PyTorch. [Image created by authors.]
Different sampling schemes on the sphere supported by S2FFT. [Original figure created by authors.]
pip install s2fft
pip install "s2fft[torch]"
import s2fft

# Compute forward spherical harmonic transform
flm = s2fft.forward_jax(f, L)

# Compute inverse spherical harmonic transform
f = s2fft.inverse_jax(flm, L)

Future perspectives

References

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Jason McEwen
Jason McEwen

Written by Jason McEwen

Professor of Astrostatistics, UCL | Founder & CEO, CopernicAI

Responses (1)