Skip to content

src/core/sources/index.js ​

text
The catalogues the Search and Plan pages read, as plug-ins, and the table built from them. No DOM.

A plug-in (nea.js, eu.js, toi.js) is { id, short, label, file, url, about, acknowledgement, planetUrl(rec),
records(json) -> { meta, records } }: it turns its snapshot into records whose values are keyed by the common
fields of fields.js, in ESL units, each with its errors and (where the catalogue has one) its reference.
Adding a catalogue is adding such a module to SOURCES and a builder for its snapshot in tools/.

buildTable() merges the records into one row per object: planets of the primary catalogue matched to those of
the others (match.js), every value labelled with the catalogue it came from, disagreements between catalogues
listed, and gaps filled from named relations (fill.js).

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

SOURCES ​

js
const SOURCES

No description in the source.

sourceById ​

js
const sourceById

No description in the source.

loadSources ​

js
function async loadSources(fetchJson, ids = SOURCES.map((s)

Load the snapshots. fetchJson(file) resolves a path under the site's public folder ('catalog-table/nea.json'). ids: which sources. Returns { [id]: { source, meta, records } }; a source that fails to load has error instead.

disagreement ​

js
function disagreement(field, a, b, ea, eb)

Compare field values a, b with errors ea, eb ([lo, hi] or undefined). Returns null when they agree, else { nsigma, frac }.

timingSigma ​

js
function timingSigma(e, now)
text
Uncertainty of the mid-transit time predicted for the transit nearest `now` (JD) from one ephemeris
{ per, tmid, perErr, tmidErr } (days; errors the symmetric mean of the catalogue's + and − errors):
  N = round((now − T0) / P),   σ(T_N) = sqrt(σ_T0² + (N σ_P)²)
P and T0 must come from one solution (one paper); their covariance is not published and is taken as zero, which
overestimates σ when T0 was not chosen near the middle of the data. Returns { sigma (days), n } or null without errors.

EPHEMERIS_CHOICES ​

js
const EPHEMERIS_CHOICES

No description in the source.

rowEphemerides ​

js
function rowEphemerides(recs)

The ephemerides one object has, keyed by choice: { best, default, eu, own }, each { kind, cat, per, tmid, perE, tmidE, perErr, tmidErr, hasErr, ref, mixed, tsys } or null, and rejected: { eu: why }. best and default come from the archive record (sources/nea.js, which already drops a best-timed pair whose period is more than 1% from the composite one); eu passes the same rule against the archive's period, and the epoch rules of sources/eu.js. own is a TOI's.

chooseEphemeris ​

js
function chooseEphemeris(E, which = 'best')

The ephemeris used for choice which, and when it is not there the one used instead with the reason (fallback).

makeRow ​

js
function makeRow(recs, prefer = 'nea', now = Date.now()
text
One table row from the records of one object in each catalogue. recs: { nea?, eu?, toi? }; prefer: source id
whose value is shown when several have one.
Row: { key, name, host, cats: ['nea', 'eu'], recs, v, e, src: {field: source id}, ref: {field: label}, lim,
       diff: {field: {a, b, nsigma, frac}}, est: {field: {value, rel, from, note}}, match }

buildTable ​

js
function buildTable(loaded, opts = {})

The whole table. loaded: the result of loadSources. opts.prefer: 'nea' | 'eu'; opts.eph: 'best' | 'default' | 'eu' (the ephemeris shown, see makeRow; none: it follows prefer); opts.now: JD of "today" for the timing uncertainty. Returns { rows, match: the result of matchCatalogues(nea, eu) or null, counts: { both, neaOnly, euOnly, toi } }.

findRow ​

js
function findRow(rows, name)

Find a row by a name as a person would type it (planet name or alias, any catalogue). Returns the row or null.

Also exported ​

FIELDS, NUMERIC_FIELDS, matchCatalogues, fillGaps

MIT licensed · Kyle A. Pearson