src/core/sources/index.js
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
const SOURCESNo description in the source.
sourceById
const sourceByIdNo description in the source.
loadSources
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
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
function timingSigma(e, now)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
const EPHEMERIS_CHOICESNo description in the source.
rowEphemerides
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
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
function makeRow(recs, prefer = 'nea', now = Date.now()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
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
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