Package: exoplanet-core
exoplanet-coreThis repository contains the compiled components for theexoplanetproject, with
implementations for NumPy, JAX, and PyMC3. Most users probably won't install or
interact withexoplanet-coredirectly, instead using it viaexoplanetitself. However, there are a few
reasons why you might be here: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.You might have found an issue with one of the compiled ops forexoplanetand want toreportorfixit.You might be looking to build a better alternative toexoplanet.All of these are excellent reasons to be here, so welcome!MotivationThis library is developed separately from theexoplanetcodebase 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.InstallationThe best way to installexoplanet-coreis usingpip:python-mpipinstallexoplanet-coreBy default this will only install thenumpyops and its dependencies (onlynumpyitself). So if you want to install the dependencies for thejaxorpymcversions, you can run:python-mpipinstall"exoplanet-core[jax]"# orpython-mpipinstall"exoplanet-core[pymc]"You can also installexoplanet-coreusingcondafromconda-forge:condainstall-cconda-forgeexoplanet-coreUsageIf 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:fromexoplanet_coreimportkeplerecc=0.3M=# compute the mean anomaly as a function of time for your measurementssinf,cosf=kepler(M,ecc)# Use the true anomaly to evaluate your modelTo compute the relative flux for a quadratically limb darkened light curve at
some projected center-to-center distanceband radius ratioror:fromexoplanet_coreimportquad_limbdark_light_curveu1,u2=0.3,0.2ror=0.05b=# Compute the impact parameter as a function of timeflux=quad_limbdark_light_curve(u1,u2,b,ror)whereu1andu2are the usual limb darkening parameters and the resulting
flux is in relative units where0is the unocculted flux. Some other
implementations that you might be familiar with return this value plus one.API Referenceexoplanet-corecurrently provides three ops, but only two are intended for
general consumption:keplerandquad_solution_vector. The three interfaces
(numpy,jax, andpymc) are designed to have the same API, so you can
import them interchangeably as:fromexoplanet_core.{interface}importopswhere{interface}isnumpy,jax, orpymc.keplersin_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.ParameterTypeDescriptionmean_anomalyarrayThis does not need to be range reduced.eccentricityarrayMust be in the range[0, 1).ReturnsTypeDescriptionsin_true_anomalyarrayThe sine and cosine of the true anomalycos_true_anomalyarrayevaluated at the input coordinates.quad_solution_vectorsoln=ops.quad_solution_vector(impact_parameter,radius_ratio)Compute the "solution vector" as defined byAgol 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.ParameterTypeDescriptionimpact_parameterarrayThe projected center to center distance.radius_ratioarrayThe radius of the occulter in units of the target.ReturnsTypeDescriptionsolnarrayThe quadratic solution vector at eachimpact_parameter.