Skip to content

Commit 4d4e37e

Browse files
committed
Update installation instructions
1 parent 2f66fbd commit 4d4e37e

File tree

1 file changed

+70
-53
lines changed

1 file changed

+70
-53
lines changed

README.md

Lines changed: 70 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -79,80 +79,118 @@ pixels of equal areas, which has many practical advantages.
7979
8080
## Installation 💻
8181

82-
The Python dependencies for the `S2FFT` package are listed in the file
83-
`requirements/requirements-core.txt` and will be automatically installed
84-
into the active python environment by [pip](https://pypi.org) when running
82+
The latest release of `S2FFT` published [on PyPI](https://pypi.org/project/s2fft/) can be installed by running
8583

86-
``` bash
84+
```bash
8785
pip install s2fft
8886
```
89-
This will install all core functionality which includes JAX support (including PyTorch support).
9087

91-
Alternatively, the `S2FFT` package may be installed directly from GitHub by cloning this
92-
repository and then running
88+
Alternatively, the latest development version of `S2FFT` may be installed directly from GitHub by running
9389

94-
``` bash
95-
pip install .
90+
```bash
91+
pip install git+https://github.com/astro-informatics/s2fft
9692
```
9793

98-
from the root directory of the repository.
94+
## Tests 🚦
9995

100-
Unit tests can then be executed to ensure the installation was successful by first installing the test requirements and then running pytest
96+
A `pytest` test suite for the package is included in the `tests` directory.
97+
To install the test dependencies, clone the repository and install the package (in [editable mode](https://setuptools.pypa.io/en/latest/userguide/development_mode.html))
98+
with the extra test dependencies by running from the root of the repository
10199

102-
``` bash
103-
pip install -r requirements/requirements-tests.txt
104-
pytest tests/
100+
```bash
101+
pip install -e ".[tests]"
105102
```
106103

107-
Documentation for the released version is available [here](https://astro-informatics.github.io/s2fft/). To build the documentation locally run
104+
To run the tests, run from the root of the repository
108105

109-
``` bash
110-
pip install -r requirements/requirements-docs.txt
106+
```bash
107+
pytest
108+
```
109+
110+
## Documentation 📖
111+
112+
Documentation for the released version is available [here](https://astro-informatics.github.io/s2fft/).
113+
To install the documentation dependencies, clone the repository and install the package (in [editable mode](https://setuptools.pypa.io/en/latest/userguide/development_mode.html))
114+
with the extra documentation dependencies by running from the root of the repository
115+
116+
```bash
117+
pip install -e ".[docs]"
118+
```
119+
120+
To build the documentation, run from the root of the repository
121+
122+
```bash
111123
cd docs
112124
make html
113125
open _build/html/index.html
114126
```
115127

116-
> [!NOTE]
117-
> For plotting functionality which can be found throughout our various notebooks, one must install the requirements which can be found in `requirements/requirements-plotting.txt`.
128+
## Notebooks 📓
129+
130+
A series of tutorial notebooks are included in the `notebooks` directory
131+
and rendered [in the documentation](https://astro-informatics.github.io/s2fft/tutorials/index.html).
132+
133+
To install the dependencies required to run the notebooks locally, clone the repository and install the package (in [editable mode](https://setuptools.pypa.io/en/latest/userguide/development_mode.html))
134+
with the extra documentation and plotting dependencies by running from the root of the repository
135+
136+
```bash
137+
pip install -e ".[docs,plotting]"
138+
```
139+
140+
To run the notebooks in Jupyter Lab, run from the root of the repository
141+
142+
```bash
143+
jupyter lab
144+
```
118145

119146
## Usage 🚀
120147

121148
To import and use `S2FFT` is as simple follows:
122149

123150
For a signal on the sphere
124151

125-
``` python
152+
```python
153+
import s2fft
154+
155+
# Define sampled signal to transform and harmonic bandlimit
156+
f = ...
157+
L = ...
126158
# Compute harmonic coefficients
127-
flm = s2fft.forward_jax(f, L)
159+
flm = s2fft.forward(f, L, method="jax")
128160
# Map back to pixel-space signal
129-
f = s2fft.inverse_jax(flm, L)
161+
f = s2fft.inverse(flm, L, method="jax")
130162
```
131163

132164
For a signal on the rotation group
133165

134-
``` python
166+
```python
167+
import s2fft
168+
169+
# Define sampled signal to transform and harmonic and azimuthal bandlimits
170+
f = ...
171+
L = ...
172+
N = ...
135173
# Compute Wigner coefficients
136-
flmn = s2fft.wigner.forward_jax(f, L, N)
174+
flmn = s2fft.wigner.forward(f, L, N, method="jax")
137175
# Map back to pixel-space signal
138-
f = fft.wigner.inverse_jax(flmn, L, N)
176+
f = fft.wigner.inverse_jax(flmn, L, N, method="jax")
139177
```
140178

141179
For further details on usage see the [documentation](https://astro-informatics.github.io/s2fft/) and associated [notebooks](https://astro-informatics.github.io/s2fft/tutorials/spherical_harmonic/spherical_harmonic_transform.html).
142180

143181
> [!NOTE]
144-
> We also provide PyTorch support for the precompute version of our transforms. These are called through forward/inverse_torch(). Full PyTorch support will be provided in future releases.
182+
> We also provide PyTorch support for the precompute version of our transforms, as demonstrated in the [_Torch frontend_ tutorial notebook](https://astro-informatics.github.io/s2fft/tutorials/torch_frontend/torch_frontend.html).
145183
146184
## JAX wrappers for SSHT and HEALPix 💡
147185

148186
`S2FFT` also provides JAX support for existing C/C++ packages, specifically [`HEALPix`](https://healpix.jpl.nasa.gov) and [`SSHT`](https://github.com/astro-informatics/ssht). This works
149-
by wrapping python bindings with custom JAX frontends. Note that this C/C++ to JAX interoperability is currently limited to CPU.
187+
by wrapping Python bindings with custom JAX frontends. Note that this C/C++ to JAX interoperability is currently limited to CPU.
150188

151189
For example, one may call these alternate backends for the spherical harmonic transform by:
152190

153191
``` python
154192
# Forward SSHT spherical harmonic transform
155-
flm = s2fft.forward(f, L, sampling=["mw"], method="jax_ssht")
193+
flm = s2fft.forward(f, L, sampling="mw", method="jax_ssht")
156194

157195
# Forward HEALPix spherical harmonic transform
158196
flm = s2fft.forward(f, L, nside=nside, sampling="healpix", method="jax_healpy")
@@ -165,31 +203,10 @@ applications!
165203

166204
For further details on usage see the associated [notebooks](https://astro-informatics.github.io/s2fft/tutorials/spherical_harmonic/JAX_SSHT_backend.html).
167205

168-
<!-- ## Benchmarking :hourglass_flowing_sand:
169-
170-
We benchmarked the spherical harmonic and Wigner transforms implemented
171-
in `S2FFT` against the C implementations in the
172-
[SSHT](https://github.com/astro-informatics/ssht) package.
173-
174-
A brief summary is shown in the table below for the recursion (left) and
175-
precompute (right) algorithms, with `S2FFT` running on GPUs (for further
176-
details see [Price & McEwen 2024]((https://arxiv.org/abs/2311.14670))).
177-
Note that our compute time is agnostic to spin number (which is not the
178-
case for many other methods that scale linearly with spin).
179-
180-
| L | Wall-Time | Speed-up | Error | Wall-Time | Speed-up | Error | Memory |
181-
|------|-----------|----------|----------|-----------|----------|----------|---------|
182-
| 64 | 3.6 ms | 0.88 | 1.81E-15 | 52.4 μs | 60.5 | 1.67E-15 | 4.2 MB |
183-
| 128 | 7.26 ms | 1.80 | 3.32E-15 | 162 μs | 80.5 | 3.64E-15 | 33 MB |
184-
| 256 | 17.3 ms | 6.32 | 6.66E-15 | 669 μs | 163 | 6.74E-15 | 268 MB |
185-
| 512 | 58.3 ms | 11.4 | 1.43E-14 | 3.6 ms | 184 | 1.37E-14 | 2.14 GB |
186-
| 1024 | 194 ms | 32.9 | 2.69E-14 | 32.6 ms | 195 | 2.47E-14 | 17.1 GB |
187-
| 2048 | 1.44 s | 49.7 | 5.17E-14 | N/A | N/A | N/A | N/A |
188-
| 4096 | 8.48 s | 133.9 | 1.06E-13 | N/A | N/A | N/A | N/A |
189-
| 8192 | 82 s | 110.8 | 2.14E-13 | N/A | N/A | N/A | N/A |
190-
191-
where the left hand results are for the recursive based algorithm and the right hand side are
192-
our precompute implementation. -->
206+
## Benchmarks ⏱️
207+
208+
A suite of benchmark functions for both the on-the-fly and precompute versions of the spherical harmonic and Wigner transforms are available in the `benchmarks` directory, along with utilities for running the benchmarks and plotting the results.
209+
193210

194211
## Contributors ✨
195212

0 commit comments

Comments
 (0)