src/core/catalog.js
System parameters from a static snapshot of the NASA Exoplanet Archive `ps` table (every published reference
per planet), built by tools/build_catalog.py into public/catalog/. The archive's TAP service has no CORS
headers, so the browser reads the snapshot instead.
No DOM here: the caller passes `fetchJson(name)` which resolves 'index.json' or 'shard-012.json' to parsed JSON.
A "row" is one archive row as a plain object keyed by the archive's column names (pl_orbper, pl_orbpererr1, ...)
plus pl_ref / pl_refurl / st_ref / st_refurl (short labels and ADS links) and `lim` ({column: true} where the
archive flags the value as a limit). Archive units: pl_trandur hours, pl_trandep percent, pl_orbsmax au,
st_dens g/cm^3, pl_rvamp m/s, masses and radii in Jupiter / solar units, angles in degrees.
Selection: the archive's default row is not always the most useful one, and the newest paper is not always
the most self-consistent. Each reference is scored by completeness for the intended use, then by how well its
own numbers obey Kepler's third law and transit geometry, and only then by date.
Conventions follow the rest of ESL: mid-transit = inferior conjunction, omega [deg] as pylightcurve / EXOTIC
use the archive's pl_orblper (transit where omega + nu = 90 deg), b = a/R* cos i (1 - e^2) / (1 + e sin omega).Import: import { … } from './src/core/catalog.js' — no DOM, runs in Node and the browser.
normalizeName
function normalizeName(s)Lowercase and strip everything but letters and digits, so "hat-p-32b" matches "HAT-P-32 b".
loadIndex
function async loadIndex(fetchJson)Load the catalogue index and build its lookup tables.
fetchJson(name) -> Promise of parsed JSON for a file in the catalogue folder.
Returns { date, rows, nplanets, nhosts, nshards, hosts: [{name, shard, aliases, planets}], planets: [{name, host, transit, rv}], ... }.searchNames
function searchNames(index, query, limit = 12)Autocomplete: names whose normalised form starts with the query, then names that contain it. Returns [{ label, type: 'planet'|'host'|'alias', planet, host, transit, rv }].
resolveName
function resolveName(index, name)Resolve a typed name to { host, hostIndex, planet|null }, or null. Accepts planet names, host names and HD / HIP / TIC aliases (with or without a planet letter).
lookupHost
function async lookupHost(index, name, fetchJson)Every archive row for every planet of the host that name (a planet, host or alias) belongs to. Returns { host, planet (the planet that was named, or null), planets: [names], system: {ra, dec, sy_dist, ...}, rows: [row objects], snapshot: date } or null when the name is not in the catalogue.
arsKepler
const arsKeplera/R* from Kepler's third law. M in Msun (star + planet), R in Rsun, P in days.
rhoFromArs
const rhoFromArsMean stellar density [g/cm^3] implied by a/R* and P: rho = 3 pi (a/R*)^3 / (G P^2), neglecting the planet's mass.rhoFromMR
const rhoFromMRMean density [g/cm^3] of a star of M [Msun], R [Rsun].
loggFromMR
const loggFromMRlog10 of surface gravity in cgs from M [Msun], R [Rsun].
impactParameter
const impactParameterImpact parameter of the transit. inc, omega in degrees.
rvAmplitude
function rvAmplitude(m, P, e, sinI, mstar)RV semi-amplitude [m/s]. m [Mjup] is the true mass when sinI is given, or M sin i with sinI = 1.transitDuration
function transitDuration(per, ars, inc, rprs, e = 0, w = 0)Full (first to fourth contact) transit duration [days], numerically exact for any eccentricity; 0 if there is no transit.
runChecks
function runChecks(q, meta = {})Physical consistency of one set of quantities. q maps internal names (per, ars, aAU, rprs, depth, t14, b, inc, ecc, omega, K, mass, rp, logg, mstar, rstar, rho) to { value, err, derived? }. A quantity marked derived is used as an input but never as the "reported" side of a comparison (it would agree with itself). meta: { transit: bool, massProv: 'Mass'|'Msini'|..., starNote / orbitNote: text appended to the checks that use stellar values / e and omega }. Returns [{ name, status: 'ok'|'warn'|'fail', detail, nsigma?, reported?, computed? }]; checks whose inputs are missing are not listed.
chooseParameters
function chooseParameters(rows, planetName, opts = {})Parameters for ONE planet from all the archive rows of its host.
opts.use 'transit' (default) | 'rv' | 'ephemeris' | 'all': what the values are for; sets what "complete" means.
opts.reference label of a reference to use instead of the best-scoring one (the UI's "pick another").
opts.star { reference, url, values: {teff, logg, feh, rstar, mstar: {value, err}} } to share one star between
planets (see systemFromRows); overrides the stellar values of the chosen row.
Returns { planet, host, reference: {label, url, pubdate, stellar, isDefault, score, why}, values, checks, alternatives, missing }.
values[key] = { value, err, source, kind, note } with kind 'reference' (the chosen reference), 'other' (another
reference, named in source), 'derived' (computed; note says from what) or 'default' (assumed).
checks are run on the assembled values; alternatives lists every reference with score, completeness and failed checks.suggestPriors
function suggestPriors(values, opts = {})Wide default priors for the assembled values, in the app's format: { type: 'uniform', a: min, b: max } or { type: 'normal', a: mean, b: std }, each with a why. They lean wide on purpose: the catalogue value centres the prior, the data should decide. Rp/R*, a/R*, i, T_mid, e, omega and K are uniform; the period and the stellar parameters (which a light curve cannot constrain) are normal with inflated widths. opts.epochs: number of orbits between the catalogue T_mid and the data, to widen the T_mid prior by the propagated period error.
systemFromRows
function systemFromRows(rows, opts = {})Parameters for every planet of a host, sharing one star.
The stellar set is chosen once: all rows of the host are grouped by stellar reference and scored by completeness (Teff, log g, [Fe/H], R*, M* with errors), by their own consistency (log g and density against M*, R*), by how many of the planets' independently chosen references use that star, then by date. Every planet is then assembled with that star, so derived quantities (a/R* from Kepler, K, Rp/R* from radii) and the consistency checks all refer to the same M* and R*.
opts: as chooseParameters (use, and references: { planetName: label } to override per planet), plus opts.stellarReference to force the star. Returns { host, star: { reference, url, values, checks, how, alternatives }, planets: [chooseParameters result with .priors] }.