Skip to main content

Differentiable JAX N-body code for modeling nearly-Keplerian orbits

Project description

jnkepler

A differentiable N-body model for multi-planet systems.

jnkepler is a Python package for modeling photometric and radial velocity data of multi-planet systems via N-body integration. Built with JAX, it leverages automatic differentiation for efficient computation of model gradients. This enables seamless integration with gradient-based optimizers and Hamiltonian Monte Carlo methods, including the No-U-Turn Sampler (NUTS) in NumPyro. The package is particularly suited for efficiently sampling from multi-planet posteriors involving a large number of parameters and strong degeneracy.

Subpackages

  • jnkepler.jaxttv: A differentialble N-body model for analyzing transit timing variations (TTVs) and radial velocities (RVs) of multi-planet systems.
  • jnkepler.nbodytransit: A differentialble photodynamical model. jaxoplanet needs to be installed for using this package.
  • jnkepler.nbodyrv: A differentiable RV model taking into account mutual interactions between planets.

See readthedocs for more details.

Installation

pip install jnkepler

CPU performance note

If you use jnkepler on CPU with JAX ≥0.4.32, the default thunk runtime in the CPU backend can make computations much slower, especially when computing gradients.

To avoid this, disable the thunk runtime by setting the following environment variable before importing jax:

export XLA_FLAGS="--xla_cpu_use_thunk_runtime=false"

Or inside Python:

import os
os.environ["XLA_FLAGS"] = "--xla_cpu_use_thunk_runtime=false"
import jax

If this is not done, jnkepler will issue a warning on import.

Examples

Explore example notebooks in the examples/ directory to see jnkepler in action:

  • minimal example: examples/minimal_example.ipynb

    • computing transit times and RVs
    • plotting TTVs
    • adding a non-transiting planet
  • TTV modeling: examples/kep51_ttv_normal.ipynb

  • Photodynamical modeling: examples/kep51_photodynamics_gp.ipynb

    • SVI optimization & posterior sampling with NUTS
    • noise modeling using Gaussian Process with tinygp

Applications

  • TOI-1136: TTV modeling of 6-planets in a resonance chain [paper]
  • TOI-2015: joint TTV & RV modeling of a two-planet system [paper]
  • Kepler-51: four-planet modeling including JWST data [paper] [repository]
  • K2-19: TTVs confirm 3:2 resonance [paper]

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jnkepler-0.2.4.tar.gz (19.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jnkepler-0.2.4-py3-none-any.whl (237.7 kB view details)

Uploaded Python 3

File details

Details for the file jnkepler-0.2.4.tar.gz.

File metadata

  • Download URL: jnkepler-0.2.4.tar.gz
  • Upload date:
  • Size: 19.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for jnkepler-0.2.4.tar.gz
Algorithm Hash digest
SHA256 56f2116c0eb092db7ccd685bc2f93f7272548d7a1ab3cba67e7f18c018100c48
MD5 0f2541ada970eef1ac16c9bb509ede9f
BLAKE2b-256 713e8aeef8727f02586cc854203882b566e59a7b07a77cd5cf8e13eb1262837b

See more details on using hashes here.

File details

Details for the file jnkepler-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: jnkepler-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 237.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for jnkepler-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 65340b16fe342f9d1a3f5adc23db7773563bd9733e934fa6aca608b5b7a91938
MD5 77c17291e2406fdaf4565dce69f2727a
BLAKE2b-256 874280b5f422395b3d0461f0a6aaaaf3ce6d815690b991e548fedf670d901028

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page