src/core/transit.js
text
Transit light curve for a limb-darkened star.
pylightcurve integrates I(r) * r * 2*acos(...) radially across the star
with fixed-order Gauss-Legendre. That integrand has square-root endpoint
singularities, so the quadrature converges slowly and needs an acos per node.
Here the area integral over the occulted region is turned into a line
integral around its boundary (Green's theorem). With
F(r) = int_0^r I(r') r' dr' (closed form for the Claret law)
the field V = F(r)/r^2 * (x, y) has div V = I(r), hence
blocked = oint F(r)/r^2 (x dy - y dx)
The boundary is an arc of the planet's limb plus (during ingress/egress) an
arc of the stellar limb, where the integrand is the constant F(1).
Along the planet's limb, parametrised by the angle phi about the planet's
centre, the integrand is smooth and periodic: when the planet is fully on
the disk the midpoint rule converges geometrically, and nodes are fixed so
cos(phi) is tabulated. No acos in the inner loop.Import: import { … } from './src/core/transit.js' — no DOM, runs in Node and the browser.
blockedFraction
js
function blockedFraction(z, p, ld)Fraction of the stellar flux blocked by an opaque disk of radius p whose centre is at projected distance z (both in stellar radii).
makeTransit
js
function makeTransit(params)text
Compile a parameter set into a fast evaluator.
params: { rprs, per, tmid, ars, inc, ecc, omega, ldLaw, ld: [...] }
returns flux(t) -> relative flux (1 out of transit)transitModel
js
function transitModel(times, params, out, opts)Evaluate the model on an array of times. opts.exptime (days) and opts.supersample (n) average the model over each exposure, which matters when the cadence is comparable to ingress duration.
Also exported
hOf, gaussLegendre