Skip to content

Commit 8a99ed0

Browse files
authored
Major update to docs (#143)
* More docstrings * More docs updates * More docs updates * API link * Update RV tutorial
1 parent 7d171c9 commit 8a99ed0

File tree

16 files changed

+268
-145
lines changed

16 files changed

+268
-145
lines changed

CONTRIBUTING.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
1-
## Contributing to exoplanet-jax
1+
# Contributor Guide
22

3-
### Reporting issues
3+
Thank you for your interest in improving this project. This project is
4+
open-source and welcomes contributions in the form of bug reports, feature
5+
requests, and pull requests.
46

5-
If you find a bug or other unexpected behavior while using `exoplanet-jax`,
6-
open an issue on the [GitHub repository](https://github.com/exoplanet-dev/exoplanet-jax/issues)
7-
and we will try to respond and (hopefully) solve the problem in a timely manner.
8-
Similarly, if you have a feature request or question about the library, the best
9-
place to post those is currently on GitHub as an issue, but that is likely
10-
change if the user community grows. If you report an issue, please give the
11-
details needed to reproduce the problem (version of exoplanet, its dependencies,
12-
and your platform) and a small standalone piece of code that demonstrates the
13-
problem clearly.
7+
Here is a list of important resources for contributors:
148

15-
### Contributing code
9+
- [Source Code](https://github.com/exoplanet-dev/jaxoplanet)
10+
- [Documentation](https://jax.exoplanet.codes)
11+
- [Issue Tracker](https://github.com/exoplanet-dev/jaxoplanet/issues)
1612

17-
We welcome contributions to the codebase of all scales from typo fixes to new features,
18-
but if you would like to add a substantial feature, it would be a good idea to first
19-
open an issue that describes your plan so that we can discuss in advance.
13+
## How to report a bug
14+
15+
Report bugs on the [Issue Tracker](https://github.com/exoplanet-dev/jaxoplanet/issues).
16+
17+
When filing an issue, make sure to answer these questions:
18+
19+
- Which operating system and Python version are you using?
20+
- Which version of this project are you using?
21+
- What did you do?
22+
- What did you expect to see?
23+
- What did you see instead?
24+
25+
The best way to get your bug fixed is to provide a test case, and/or steps to
26+
reproduce the issue. In particular, please include a [Minimal, Reproducible
27+
Example](https://stackoverflow.com/help/minimal-reproducible-example).
28+
29+
## How to request a feature
30+
31+
Feel free to request features on the [Issue
32+
Tracker](https://github.com/exoplanet-dev/jaxoplanet/issues).
33+
34+
## How to test the project
35+
36+
```bash
37+
python -m pip install nox
38+
python -m nox -s test
39+
```
40+
41+
## How to submit changes
42+
43+
Open a [Pull Request](https://github.com/exoplanet-dev/jaxoplanet/pulls).

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ _Astronomical time series analysis with JAX_
44

55
---
66

7-
_jaxoplanet_ is a [functional-programming](https://en.wikipedia.org/wiki/Functional_programming)-forward implementation of many features from the
7+
_jaxoplanet_ is a
8+
[functional-programming](https://en.wikipedia.org/wiki/Functional_programming)-forward
9+
implementation of many features from the
810
[exoplanet](https://docs.exoplanet.codes/en/latest/) and
911
[starry](https://starry.readthedocs.io/en/latest/) packages built on top of
1012
[JAX](https://jax.readthedocs.io/en/latest/).
1113

1214
*jaxoplanet* includes fast and robust implementations of many exoplanet-specific
1315
operations, including solving Kepler's equation, and computing limb-darkened
14-
light curves. Since *jaxoplanet* is built on top of JAX it has have first-class
15-
support for hardware acceleration using GPUs and TPUs, and it also integrates seamlessly
16-
with modeling tools like [NumPyro](https://numpyro.readthedocs.io/en/latest/),
17-
and [Flax](https://flax.readthedocs.io/en/latest/).
16+
light curves. Since *jaxoplanet* is built on top of JAX it has first-class
17+
support for hardware acceleration using GPUs and TPUs, and it also integrates
18+
seamlessly with modeling tools like
19+
[NumPyro](https://numpyro.readthedocs.io/en/latest/), and
20+
[Flax](https://flax.readthedocs.io/en/latest/).
1821

22+
**For the most complete documentation, check out the documentation page at
23+
[jax.exoplanet.codes](https://jax.exoplanet.codes).**
1924

2025
## Installation
2126

@@ -33,14 +38,17 @@ Then install _jaxoplanet_ with:
3338
python -m pip install jaxoplanet
3439
```
3540

36-
If you run into issues with installing *jaxoplanet*, take a look at the **Troubleshooting on *jaxoplanet* installation** page.
41+
If you run into issues with installing *jaxoplanet*, take a look at [the
42+
installation instructions](https://jax.exoplanet.codes/en/latest/install).
3743

3844
## Quick start
3945

4046

4147
## Attribution
42-
While we don't yet have a citation for *jaxoplanet*, please reference the GitHub repository if you find
43-
this code useful in your research. The BibTeX entry for the repo is:
48+
49+
While we don't yet have a citation for *jaxoplanet*, please reference the GitHub
50+
repository if you find this code useful in your research. The BibTeX entry for
51+
the repo is:
4452

4553
```
4654
@software{jaxoplanet,
@@ -56,4 +64,5 @@ this code useful in your research. The BibTeX entry for the repo is:
5664
## License
5765
Copyright (c) 2021-2024 Simons Foundation, Inc.
5866

59-
*jaxoplanet* is free software made available under the MIT License. For details see the LICENSE file.
67+
*jaxoplanet* is free software made available under the MIT License. For details
68+
see the LICENSE file.

docs/code-of-conduct.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```{include} ../CODE_OF_CONDUCT.md
2+
3+
```

docs/contributing.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(contributing)=
2+
3+
```{include} ../CONTRIBUTING.md
4+
5+
```
6+
7+
```{toctree}
8+
:maxdepth: 1
9+
:hidden:
10+
11+
code-of-conduct
12+
```

docs/guide.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(guide)=
2+
3+
# User Guide
4+
5+
The following pages give some background on the context within which `jaxoplanet`
6+
exists, as well as detailed installation and API documentation. Click through
7+
for all the details, or head over to the {ref}`tutorials` for a more hands-on
8+
experience.
9+
10+
```{toctree}
11+
:maxdepth: 1
12+
13+
install
14+
troubleshooting
15+
```

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
maxdepth: 1
99
---
1010
11-
installation
11+
guide
1212
tutorials
13+
contributing
1314
```

docs/install.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
(install)=
2+
3+
# Installation Guide
4+
5+
`jaxoplanet` is built on top of [`jax`](https://github.com/google/jax) so that's the
6+
primary dependency that you'll need. All of the methods below will install any
7+
required dependencies, but if you want to take advantage of your GPU, that might
8+
take a little more setup. `jaxoplanet` doesn't have any GPU-specific code, so it
9+
should be enough to just [follow the installation instructions for CUDA support
10+
in the `jax` README](https://github.com/google/jax/#installation).
11+
12+
## Using pip
13+
14+
The easiest way to install the most recent stable version of `jaxoplanet` is
15+
with [pip](https://pip.pypa.io):
16+
17+
```bash
18+
python -m pip install jaxoplanet
19+
```
20+
21+
## From source
22+
23+
Alternatively, you can get the source:
24+
25+
```bash
26+
git clone https://github.com/exoplanet-dev/jaxoplanet.git
27+
cd jaxoplanet
28+
python -m pip install -e .
29+
```
30+
31+
## Tests
32+
33+
If you installed from source, you can run the unit tests. From the root of the
34+
source directory, run:
35+
36+
```bash
37+
python -m pip install nox
38+
python -m nox -s test
39+
```

docs/installation.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

docs/troubleshooting.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
(troubleshooting)=
2+
3+
# Troubleshooting
4+
5+
This page includes some tips for troubleshooting issues that you might run into
6+
when using `jaxoplanet`. This is a work-in-progress, so if you don't see your
7+
issue listed here, feel free to open an issue on the [GitHub repository issue
8+
tracker](https://github.com/exoplanet-dev/jaxoplanet/issues).
9+
10+
## NaNs and infinities
11+
12+
It's not that uncommon to hit NaNs or infinities when using `jax` and
13+
`jaxoplanet`. This is often caused by numerical precision issues, and this can
14+
be exacerbated by the fact that, by default, `jax` disables double precision
15+
calculations. You can enable double precision [a few different ways as described
16+
in the `jax`
17+
docs](https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html#double-64bit-precision),
18+
and the way we do it in these docs is to add the following, when necessary:
19+
20+
```python
21+
import jax
22+
23+
jax.config.update("jax_enable_x64", True)
24+
```
25+
26+
If enabling double precision doesn't do the trick, this often means that there's
27+
an issue with the parameter or modeling choices that you're making. `jax`'s
28+
["debug NaNs" mode](https://jax.readthedocs.io/en/latest/debugging/flags.html)
29+
can help diagnose issues here.
30+
31+
## Installation issues on ARM Macs
32+
33+
Follow these steps to install `jax` and `jaxoplanet` on your system, with
34+
special instructions for Mac M1 chip or newer.
35+
36+
### Step 1: Check Your Python Architecture
37+
38+
First, verify your Python architecture to determine if you're on an ARM or
39+
Intel-based chip.
40+
41+
```bash
42+
import platform
43+
platform.machine()
44+
```
45+
46+
- If the output is "arm64", proceed with the following steps.
47+
- If the output is "x86-64", you're running an Intel emulator on an Apple
48+
silicon chip and need to switch to arm64.
49+
50+
For the best performance of `jax`, it will be better to install Python under
51+
the arm64 architecture.
52+
53+
**Install Miniforge for ARM64.**
54+
55+
Download Miniforge from the official Conda Forge page (https://conda-forge.org/miniforge/).
56+
Run the installer script:
57+
58+
```bash
59+
bash Mambaforge-23.11.0-0-MacOSX-arm64.sh
60+
```
61+
62+
Restart the terminal.
63+
64+
### Step 2: Install `jax` and `jaxoplanet`
65+
66+
Create a New Environment (Optional) in miniforge.
67+
68+
It's a good practice to create a new environment for your projects:
69+
70+
```bash
71+
conda create --name jaxoplanet
72+
conda activate jaxoplanet
73+
conda install pip
74+
75+
conda install jax
76+
# or
77+
python -m pip install "jax[cpu]"
78+
```
79+
80+
Then install `jaxoplanet` using the instructions in {ref}`install`.

0 commit comments

Comments
 (0)