Skip to content

src/core/aliases.js ​

text
Period aliases of a planet seen in only a few, widely spaced transits.

Transits seen at t_1 < t_2 < ... separated by S (or multiples of it) fix the period only to P = S / N for a whole
number N of orbits between them. Coverage removes most N: an alias that predicts a transit inside data that were
taken, where none was seen, is excluded. What survives goes to the sampler in one of two ways (model.js, buildProblem):

  * one categorical parameter: the planet's "nalias" (planet-scoped, "nalias@d") with the prior
    { type: 'categorical', values: allowed N, weights? } and "palias" = S (fixed, or free with a narrow prior); the
    period is palias / nalias. One run then gives the evidence of the whole set (the prior-weighted mean of the
    evidences of each N) and the posterior probability of each alias (the weight of its samples);
  * one run per allowed N (aliasRuns) with the evidences compared afterwards (combineAliasEvidence).
The two agree (test/aliases.test.mjs); the first costs about one run, the second gives each alias its own posterior.

The scan is the rule of EXOTIC's toi1873_extract.py (stage_alias_scan): a predicted transit is "covered" when more
than half (minCoverage) of the window [x - T14/2, x + T14/2] has data, and "missed" when covered and more than
matchTol (0.1 d) from every transit that was seen. T14 is that of each alias (a/R* from Kepler's law at that
period), so long aliases need more of a gap to be excluded.

Import: import { … } from './src/core/aliases.js' — no DOM, runs in Node and the browser.

coverageIntervals ​

js
function coverageIntervals(t, cadence, { maxGap } = {})

Merged time intervals covered by data. t: times (any order), cadence: one number (days) or one per point; each point covers t +- cadence/2; spans closer than maxGap (default: one cadence) are joined. Returns [[start, end], ...] sorted.

coveredLength ​

js
function coveredLength(iv, a, b)

Length of [a, b] covered by the sorted, disjoint intervals. An interval may instead be a run of exposures, [first centre, last centre, cadence]: it then contributes cadence x (number of centres strictly inside (a, b)), the rule of EXOTIC's alias scan (sum of the cadences of the points in the window).

transitDuration ​

js
function transitDuration(P, g)
text
Total transit duration [d] (first to fourth contact): P / pi asin( sqrt((1 + k)^2 - b^2) / (a/R* sin i) ), b = a/R* cos i,
times sqrt(1 - e^2) / (1 + e sin omega) for an eccentric orbit. a/R* from Kepler's law (mstar [M_sun], rstar [R_sun])
unless g.ars is given. NaN when the planet does not transit.

aliasScan ​

js
function aliasScan(o)
text
Which aliases survive the coverage.
o = { transits: [times seen],
      span: S (default: the smallest spacing between consecutive transits seen, averaged over the whole set when every
            spacing is a multiple of it),
      coverage: [[start, end], ...] (coverageIntervals), runs [[first, last, cadence], ...] (coveredLength), or { t, cadence },
      duration: days | (P) => days | { rprs, mstar, rstar, inc?, ecc?, omega? } (transitDuration),
      nMax (25), minCoverage (0.5), matchTol (0.1 d),
      reference: time from which transits are predicted (default the first transit seen) }
Returns { span, rows: [{ N, per, t14, predicted, covered, missed, missedTimes, consistent, allowed }], allowed: [N ...] }.
consistent: every transit seen lies within matchTol of a predicted one (false when S / N does not divide the spacings).

aliasPrior ​

js
function aliasPrior(allowed, weights = 'uniform')

Categorical prior over the allowed N. weights: 'uniform' (default) or 'geometric': proportional to the transit probability R* / a, i.e. N^(2/3) at fixed span (a shorter period is more likely to transit), as in the owner's TOI-1873 alias comparison ("geom. prior" column); or an array.

aliasRuns ​

js
function aliasRuns(spec, sfx, allowed)

One fit specification per alias: the planet's nalias is fixed at each N (and dropped from the free list). spec: a buildProblem specification in which planet sfx has nalias (free with a categorical prior, or fixed) and palias. Returns [{ N, spec }].

combineAliasEvidence ​

js
function combineAliasEvidence(runs, weights = 'uniform')
text
Combine the evidences of one run per alias: runs = [{ N, logZ, logZerr }], weights as in aliasPrior.
Returns { logZ (of the whole set: the prior-weighted mean), logZerr, probs: [{ N, p, err }] } where p = w_N Z_N / sum.

MIT licensed · Kyle A. Pearson