Contents:
FUNCTIONS: | occultuniform() – uniform-disk transit light curve occultquad() – quadratic limb-darkening occultnonlin() – full (4-parameter) nonlinear limb-darkening
|
---|---|
REQUIREMENTS: | |
NOTES: | Certain values of p (<0.09, >0.5) cause some routines to hang; your mileage may vary. If you find out why, please let me know!
For occultquad() I relied heavily on the IDL code of E. Agol and J. Eastman. Function appellf1() comes from the mpmath compilation, and is adopted (with modification) for use herein in compliance with its BSD license (see function documentation for more details). |
REFERENCE: | The main reference is that seminal work by Mandel and Agol (2002). |
LICENSE: | Created by Ian Crossfield at UCLA. The code contained herein may be reused, adapted, or modified so long as proper attribution is made to the original authors. |
REVISIONS: |
2011-04-25 17:32 IJMC: Fixed bug in ellpic_bulirsch().
|
Fit transit to data, and estimate uncertainties on the fit.
Inputs : |
|
---|---|
Outputs : | (some object with useful fields) |
Analytic continuations of the Appell hypergeometric function of 2 variables.
Reference : | Olsson 1964, Colavecchia et al. 2001 |
---|
Give the Appell hypergeometric function of two variables.
Inputs : | six parameters, all scalars. |
---|---|
Options : | eps – scalar, machine tolerance precision. Defaults to 1e-12. |
Notes : | Adapted from the mpmath module, but using the scipy (instead of mpmath) Gauss hypergeometric function speeds things up. |
License : | MPMATH Copyright (c) 2005-2010 Fredrik Johansson and mpmath contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Compute Hasting’s polynomial approximation for the complete elliptic integral of the first (ek) and second (kk) kind.
Inputs : | k – scalar or Numpy array |
---|---|
Outputs : | ek, kk |
Notes : | Adapted from the IDL function of the same name by J. Eastman (OSU). |
Compute complete elliptic integrals of the first kind (K) and second kind (E) using the series expansions.
Compute the complete elliptical integral of the third kind using the algorithm of Bulirsch (1965).
Inputs : | n – scalar or Numpy array k– scalar or Numpy array |
---|---|
Notes : | Adapted from the IDL function of the same name by J. Eastman (OSU). |
data: time series to fit using least-squares.
sv: state vectors (e.g., various instrumental parameters)
ords: orders to raise each sv vector to: e.g., [1, [1,2], 3]
tlc: eclipse light curve
edata: error on the data (for chisq ONLY! No weighted fits.)
index: array index to apply to data, sv, and tlc
dopb: do prayer-bead uncertainty analysis
dotransit: include tlc in the fitting; otherwise, leave it out.
Return the integral in I*(z) in Eqn. 8 of Mandel & Agol (2002). – Int[I(r) 2r dr]_{z-p}^{1}, where:
Inputs : |
p = scalar. Planet/star radius ratio.
lower, upper – floats. Limits of integration in units of mu |
---|---|
Returns : | value of the integral at specified z. |
MCMC for 3-parameter eclipse function with KNOWN orbit
Inputs : |
|
---|---|
Returns : |
|
References : | Numerical Recipes, 3rd Edition (Section 15.8); Wikipedia |
MCMC for 5-parameter eclipse function of transit with KNOWN period
Inputs : |
|
---|---|
Returns : |
|
References : | Numerical Recipes, 3rd Edition (Section 15.8); Wikipedia |
MCMC for 5-parameter eclipse function of transit with KNOWN period
Inputs : |
|
---|---|
Returns : |
|
References : | Numerical Recipes, 3rd Edition (Section 15.8); Wikipedia |
Model an eclipse light curve of arbitrary type to a flux time series, assuming zero eccentricity and a fixed, KNOWN period.
Inputs : |
func – function to fit to data; presumably transit.occultuniform()
|
---|
Model an eclipse light curve of arbitrary type to a flux time series, assuming zero eccentricity and a fixed, KNOWN orbit.
Inputs : |
func – function to fit to data; presumably transit.occultuniform() t – numpy array. Time of observations. |
---|
Model an eclipse light curve of arbitrary type to a flux time series, assuming zero eccentricity and a fixed, KNOWN orbit.
Inputs : |
func – function to fit to data; presumably transit.occultuniform()
|
---|
Model a full planetary light curve: transit, eclipse, and (sinusoidal) phase variation. Accept independent eclipse and transit times-of-center, but otherwise assume a circular orbit (and thus symmetric transits and eclipses).
Inputs : | params – (M+10+N)-sequence with the following:
|
---|---|
Options : |
|
Example : | TBW |
Model a transit light curve of arbitrary type to a flux time series, assuming zero eccentricity and a fixed, KNOWN period.
Inputs : |
func – function to fit to data, e.g. transit.occultquad per – float. Orbital period, in days. t – numpy array. Time of observations. |
---|
Model a transit light curve of arbitrary type to a flux time series, assuming zero eccentricity and a fixed, KNOWN period, and assuming MIPS-type data with 14 separate sensitivity dependencies.
Inputs : | params – (14+5+N)-sequence with the following:
func – function to fit to data, e.g. transit.occultquad per – float. Orbital period, in days.
|
---|---|
See ALSO: |
Model a transit light curve of arbitrary type to a flux time series, assuming zero eccentricity.
Inputs : |
t – numpy array. Time of observations.
|
---|---|
Notes : | If quadratic or linear limb-darkening (L.D.) is used, the sum of the L.D. coefficients cannot exceed 1. If they do, this routine normalizes the coefficients [g1,g2] to: g_i = g_i / (g1 + g2). If “Rp/R*”, or “R*/a” are < 0, they will be set to zero. If “P” < 0.01, it will be set to 0.01. If “inc” > 90, it will be set to 90. |
Nonlinear limb-darkening light curve; cf. Section 3 of Mandel & Agol (2002).
Inputs : | z – sequence of positional offset values p0 – planet/star radius ratio cn – four-sequence. nonlinear limb darkening coefficients |
---|---|
Example : | # Reproduce Figure 2 of Mandel & Agol (2002):
from pylab import *
import transit
z = linspace(0, 1.2, 50)
cns = vstack((zeros(4), eye(4)))
figure()
for coef in cns:
f = transit.occultnonlin(z, 0.1, coef)
plot(z, f)
|
See ALSO: | |
Notes : | Scipy is much faster than mpmath for computing the Beta and Gauss hypergeometric functions. However, Scipy does not have the Appell hypergeometric function – the current version is not vectorized. |
Nonlinear limb-darkening light curve in the small-planet approximation (section 5 of Mandel & Agol 2002).
Inputs : | z – sequence of positional offset values p – planet/star radius ratio
|
---|---|
Note : | I had to divide the effect at the near-edge of the light curve by pi for consistency; this factor was not in Mandel & Agol, so I may have coded something incorrectly (or there was a typo). |
Example : | # Reproduce Figure 2 of Mandel & Agol (2002):
from pylab import *
import transit
z = linspace(0, 1.2, 100)
cns = vstack((zeros(4), eye(4)))
figure()
for coef in cns:
f = transit.occultnonlin_small(z, 0.1, coef)
plot(z, f, '--')
|
See ALSO: |
Quadratic limb-darkening light curve; cf. Section 4 of Mandel & Agol (2002).
Inputs : | z – sequence of positional offset values p0 – planet/star radius ratio
|
---|---|
Options : |
|
Example : | # Reproduce Figure 2 of Mandel & Agol (2002):
from pylab import *
import transit
z = linspace(0, 1.2, 100)
gammavals = [[0., 0.], [1., 0.], [2., -1.]]
figure()
for gammas in gammavals:
f = transit.occultquad(z, 0.1, gammas)
plot(z, f)
# Calculate the same geometric transit with two different
# sets of limb darkening coefficients:
from pylab import *
import transit
p, b = 0.1, 0.5
x = (arange(300.)/299. - 0.5)*2.
z = sqrt(x**2 + b**2)
gammas = [.25, .75]
F1, Funi, lambdad, etad = transit.occultquad(z, p, gammas, retall=True)
gammas = [.35, .55]
F2 = 1. - ((1. - gammas[0] - 2.*gammas[1])*(1. - F1) +
(gammas[0] + 2.*gammas[1])*(lambdad + 2./3.*(p > z)) + gammas[1]*etad) /
(1. - gammas[0]/3. - gammas[1]/6.)
figure()
plot(x, F1, x, F2)
legend(['F1', 'F2'])
|
See ALSO: | |
Notes : | In writing this I relied heavily on the occultquad IDL routine by E. Agol and J. Eastman, especially for efficient computation of elliptical integrals and for identification of several apparent typographic errors in the 2002 paper (see comments in the source code). From some cursory testing, this routine appears about 9 times slower than the IDL version. The difference drops only slightly when using precomputed quantities (i.e., retall=True). A large portion of time is taken up in ellpic_bulirsch() and ellke(), but at least as much is taken up by this function itself. More optimization (or a C wrapper) is desired! |
Uniform-disk transit light curve (i.e., no limb darkening).
Inputs : |
p – scalar; planet/star radius ratio.
|
---|---|
See ALSO: |
Placeholder for backwards compatibility with my old code. The function is now called occultnonlin_small().
Convert HJD (time) to transit crossing parameter z.
Inputs : | tt – scalar. transit ephemeris per – scalar. planetary orbital period inc – scalar. orbital inclination (in degrees)
ars – scalar. ratio a/Rs, orbital semimajor axis over stellar radius ecc – scalar. orbital eccentricity. longperi=0 scalar. longitude of periapse (in radians) |
---|---|
Algorithm : | At zero eccentricity, z relates to physical quantities by: z = (a/Rs) * sqrt(sin[w*(t-t0)]**2+[cos(i)*cos(w*[t-t0])]**2) |
Placeholder for my old code; the new function is called occultuniform().
Convert transit crossing parameter z to a time offset for circular orbits.
Inputs : | per – scalar. planetary orbital period inc – scalar. orbital inclination (in degrees) ars – scalar. ratio a/Rs, orbital semimajor axis over stellar radius z – scalar or array; transit crossing parameter z. |
---|---|
Returns : |
|