|
1 | 1 | :html_theme.sidebar_secondary.remove: |
2 | 2 |
|
3 | | -************************** |
4 | | -Notebooks |
5 | | -************************** |
6 | | -A series of tutorial notebooks which go through the absolute base level application of |
7 | | -``S2FFT`` apis. Post alpha release we will add examples for more involved applications, |
8 | | -in the time being feel free to contact contributors for advice! At a high-level the |
9 | | -``S2FFT`` package is structured such that the 2 primary transforms, the Wigner and |
10 | | -spherical harmonic transforms, can easily be accessed. |
| 3 | +***************************** |
| 4 | +Tutorials |
| 5 | +***************************** |
| 6 | + |
| 7 | +This section contains a series of tutorial notebooks which go through some of the |
| 8 | +key features of the ``S2FFT`` package. |
| 9 | + |
| 10 | +At a high-level the ``S2FFT`` package is structured such that the two primary transforms, |
| 11 | +the Wigner and spherical harmonic transforms, can easily be accessed. |
11 | 12 |
|
12 | 13 | Core usage |:rocket:| |
13 | | ------------------ |
14 | | -To import and use ``S2FFT`` is as simple follows: |
| 14 | +----------------------------- |
| 15 | + |
| 16 | +To import and use ``S2FFT`` is as simple follows: |
15 | 17 |
|
16 | 18 | +-------------------------------------------------------+------------------------------------------------------------+ |
17 | 19 | |For a signal on the sphere |For a signal on the rotation group | |
18 | 20 | | | | |
19 | 21 | |.. code-block:: Python |.. code-block:: Python | |
20 | 22 | | | | |
| 23 | +| import s2fft | import s2fft | |
| 24 | +| | | |
| 25 | +| # Specify sampled signal and harmonic bandlimit | # Define sampled signal, harmonic & azimuthal bandlimits | |
| 26 | +| f = ... | f = ... | |
| 27 | +| L = ... | L, N = ... | |
| 28 | +| | | |
21 | 29 | | # Compute harmonic coefficients | # Compute Wigner coefficients | |
22 | | -| flm = s2fft.forward_jax(f, L) | flmn = s2fft.wigner.forward_jax(f, L, N) | |
| 30 | +| flm = s2fft.forward(f, L, method="jax") | flmn = s2fft.wigner.forward(f, L, N, method="jax") | |
23 | 31 | | | | |
24 | 32 | | # Map back to pixel-space signal | # Map back to pixel-space signal | |
25 | | -| f = s2fft.inverse_jax(flm, L) | f = s2fft.wigner.inverse_jax(flmn, L, N) | |
| 33 | +| f = s2fft.inverse(flm, L, method="jax") | f = s2fft.wigner.inverse(flmn, L, N, method="jax") | |
26 | 34 | +-------------------------------------------------------+------------------------------------------------------------+ |
27 | 35 |
|
28 | | -C/C++ backend usage |:bulb:| |
29 | | ------------------ |
30 | | -``S2FFT`` also provides JAX support for existing C/C++ packages, specifically `HEALPix <https://healpix.jpl.nasa.gov>`_ |
31 | | -and `SSHT <https://github.com/astro-informatics/ssht>`_. This works |
32 | | -by wrapping python bindings with custom JAX frontends. Note that currently this C/C++ to JAX interoperability is currently |
33 | | -limited to CPU, however for many applications this is desirable due to memory constraints. |
34 | | - |
35 | | -For example, one may call these alternate backends for the spherical harmonic transform by: |
36 | | - |
37 | | -.. code-block:: python |
38 | | -
|
39 | | - # Forward SSHT spherical harmonic transform |
40 | | - flm = s2fft.forward(f, L, sampling=["mw"], method="jax_ssht") |
41 | | -
|
42 | | - # Forward HEALPix spherical harmonic transform |
43 | | - flm = s2fft.forward(f, L, nside=nside, sampling="healpix", method="jax_healpy") |
44 | | -
|
45 | | -All of these JAX frontends supports out of the box reverse mode automatic differentiation, |
46 | | -and under the hood is simply linking to the C/C++ packages you are familiar with. In this |
47 | | -way ``S2FFT`` enhances existing packages with gradient functionality for modern signal processing |
48 | | -applications! |
49 | | - |
50 | | - |
51 | 36 | .. toctree:: |
52 | 37 | :hidden: |
53 | 38 | :maxdepth: 3 |
54 | | - :caption: Jupyter Notebooks |
| 39 | + :caption: Tutorials |
55 | 40 |
|
56 | 41 | spherical_harmonic/spherical_harmonic_transform.nblink |
57 | 42 | wigner/wigner_transform.nblink |
|
0 commit comments