src/core/sources/match.js
Matching the planets of two catalogues. No DOM.
Catalogues disagree on names more than on anything else: "WASP-12 b" is "WASP-12 Ab" in exoplanet.eu, "55 Cnc e"
is "55 Cnc Ae", hosts go by HD, HIP, GJ, KOI, TOI or 2MASS designations, and a few planets carry different
letters. A match is therefore made in stages, most trustworthy first, and every candidate pair made on names
is then checked against two things that do not depend on names: the position on the sky and the period.
1 name the names agree once case, spaces and punctuation are removed, also after dropping the
component letter of the PRIMARY star ("WASP-12 Ab" -> "WASP-12 b"; a "B" is never dropped:
"55 Cnc Bb" is not "55 Cnc b")
2 alias one of the alternate planet names agrees
3 host+letter a host name or host alias of one agrees with one of the other, and the planet letters agree
4 position no name agrees, but the stars are within 1 arcmin and the periods within 3% (or, without
periods, the letters agree and the star hosts one such planet)
A pair made on an alias or a host name (stages 2 and 3) is rejected when the stars are more than SEP_REJECT apart
(unless the periods agree to 0.1%), or when both give a period below 2000 d and they differ by more than 20%.
Identical names (stage 1) are kept whatever the positions say, and flagged: see accept(). Pairs that are kept
but look doubtful carry flags.Import: import { … } from './src/core/sources/match.js' — no DOM, runs in Node and the browser.
SEP_REJECT
const SEP_REJECTNo description in the source.
SEP_WARN
const SEP_WARNNo description in the source.
planetLetter
function planetLetter(name)Planet letter of a name ("b" for "WASP-12 b", "WASP-12 Ab", "Kepler-16 (AB) b"), or '' when it has none.
hostOfName
function hostOfName(name)The name without the planet letter, and without a trailing primary-star designation: "WASP-12 Ab" -> "WASP-12".nameKeys
function nameKeys(name)Keys under which a planet name may be found: the normalised name, and the name with the primary's "A" removed.
hostKeys
function hostKeys(host)Keys of a host name: normalised, and without a trailing primary-star "A".
separation
function separation(a, b)Angular separation in degrees of two records with ra, dec (NaN when either lacks them).
matchCatalogues
function matchCatalogues(A, B)Match the records of catalogue B to those of catalogue A (one to one). Returns { pairs: [{ a, b, stage, sep, dper, flags: [..] }], onlyA: [rec], onlyB: [rec], rejectedPairs, stats }. stats: { nA, nB, matched, byStage: {name, alias, 'host+letter', position}, rejected: {position, period}, flagged, onlyA, onlyB }.