Skip to main content

The compiled backend for exoplanet

Project description



Tests

exoplanet-core

This repository contains the compiled components for the exoplanet project, with implementations for NumPy, JAX, and PyMC3. Most users probably won't install or interact with exoplanet-core directly, instead using it via exoplanet itself. However, there are a few reasons why you might be here:

  1. You want to evaluate a quadratically limb darkened light curve or solve Kepler's equation in numpy, JAX, or PyMC3, using fast and well-tested code.
  2. You might have found an issue with one of the compiled ops for exoplanet and want to report or fix it.
  3. You might be looking to build a better alternative to exoplanet.

All of these are excellent reasons to be here, so welcome!

Motivation

This library is developed separately from the exoplanet codebase for several reasons, but the main one is that the code in this repo needs to change at a less frequent cadence than the main exoplanet modeling code and there is some cost associated with re-compiling the backend. I'm hoping that this separation will make it easier for people to contribute to the exoplanet project without dealing with compilation issues. This also means that some users can use just the computational components here without the heavy dependencies required by the exoplanet project. This might be useful, for example, for people who just want a high performance solver for Kepler's equation or fast quadratically limb-darkened light curves.

Installation

The best way to install exoplanet-core is using pip:

python -m pip install exoplanet-core

By default this will only install the numpy ops and its dependencies (only numpy itself). So if you want to install the dependencies for the jax or pymc versions, you can run:

python -m pip install "exoplanet-core[jax]"
# or
python -m pip install "exoplanet-core[pymc]"

You can also install exoplanet-core using conda from conda-forge:

conda install -c conda-forge exoplanet-core

Usage

If you're developing new ops or fixing existing ones, you'll probably want to skip to the next section, but if you just want to solve Kepler's equation or compute a limb darkened light curve, you can use the following snippets.

To solve Kepler's equation and compute the true anomaly for an array of eccentricities:

from exoplanet_core import kepler

ecc = 0.3
M = # compute the mean anomaly as a function of time for your measurements

sinf, cosf = kepler(M, ecc)

# Use the true anomaly to evaluate your model

To compute the relative flux for a quadratically limb darkened light curve at some projected center-to-center distance b and radius ratio ror:

from exoplanet_core import quad_limbdark_light_curve

u1, u2 = 0.3, 0.2
ror = 0.05
b = # Compute the impact parameter as a function of time
flux = quad_limbdark_light_curve(u1, u2, b, ror)

where u1 and u2 are the usual limb darkening parameters and the resulting flux is in relative units where 0 is the unocculted flux. Some other implementations that you might be familiar with return this value plus one.

API Reference

exoplanet-core currently provides three ops, but only two are intended for general consumption: kepler and quad_solution_vector. The three interfaces (numpy, jax, and pymc) are designed to have the same API, so you can import them interchangeably as:

from exoplanet_core.{interface} import ops

where {interface} is numpy, jax, or pymc.

kepler

sin_true_anomaly, cos_true_anomaly = ops.kepler(mean_anomaly, eccentricity)

Solve Kepler's equation and convert to the true anomaly using a fast method (Brandt et al., in prep) that gives nearly machine precision across the full valid parameter range.

Parameter Type Description
mean_anomaly array This does not need to be range reduced.
eccentricity array Must be in the range [0, 1).
Returns Type Description
sin_true_anomaly array The sine and cosine of the true anomaly
cos_true_anomaly array evaluated at the input coordinates.

quad_solution_vector

soln = ops.quad_solution_vector(impact_parameter, radius_ratio)

Compute the "solution vector" as defined by Agol et al. (2020) for a quadratically limb darkened light curve. This can then be dotted into a vector of coefficients (a function of the usual limb darkening parameters) to compute the integrated flux.

Parameter Type Description
impact_parameter array The projected center to center distance.
radius_ratio array The radius of the occulter in units of the target.
Returns Type Description
soln array The quadratic solution vector at each impact_parameter.

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

exoplanet_core-0.3.0.tar.gz (35.3 kB view hashes)

Uploaded Source

Built Distributions

exoplanet_core-0.3.0-cp312-cp312-win_amd64.whl (157.0 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

exoplanet_core-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (233.9 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

exoplanet_core-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (149.3 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

exoplanet_core-0.3.0-cp312-cp312-macosx_10_9_x86_64.whl (156.4 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

exoplanet_core-0.3.0-cp311-cp311-win_amd64.whl (158.9 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

exoplanet_core-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (234.2 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

exoplanet_core-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (154.2 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

exoplanet_core-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl (161.3 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

exoplanet_core-0.3.0-cp310-cp310-win_amd64.whl (156.9 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

exoplanet_core-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (230.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

exoplanet_core-0.3.0-cp310-cp310-macosx_11_0_arm64.whl (151.4 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

exoplanet_core-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl (158.7 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

exoplanet_core-0.3.0-cp39-cp39-win_amd64.whl (156.4 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

exoplanet_core-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (230.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

exoplanet_core-0.3.0-cp39-cp39-macosx_11_0_arm64.whl (151.7 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

exoplanet_core-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl (159.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

exoplanet_core-0.3.0-cp38-cp38-win_amd64.whl (157.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

exoplanet_core-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (230.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

exoplanet_core-0.3.0-cp38-cp38-macosx_11_0_arm64.whl (151.3 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

exoplanet_core-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl (158.6 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

exoplanet_core-0.3.0-cp37-cp37m-win_amd64.whl (158.1 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

exoplanet_core-0.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (233.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

exoplanet_core-0.3.0-cp37-cp37m-macosx_10_9_x86_64.whl (158.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

exoplanet_core-0.3.0-cp36-cp36m-win_amd64.whl (158.5 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

exoplanet_core-0.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (233.1 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

exoplanet_core-0.3.0-cp36-cp36m-macosx_10_9_x86_64.whl (156.9 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

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