Skip to content

src/core/rvsources.js ​

text
Radial velocities from public archives: which catalogues hold RV time series that a browser can fetch, how to ask
them, and how to read what they return. Pure: no DOM, no fetch. The caller passes a `fetchText(url)` function, so the
same code runs in a page, in Node (tests read saved responses from test/data/rv/) and in a worker.

What a browser can reach (checked 2026-11-16 with curl, Origin header set; see the report in test/rvsources.test.mjs):
  VizieR ASU (viz-bin/asu-tsv) on the CfA and IDIA mirrors answers with Access-Control-Allow-Origin: *. The CDS
  main site returned 404 for viz-bin that day and TAPVizieR timed out; both stay in the mirror list as fallbacks.
  NASA Exoplanet Archive TAP sends no Access-Control-Allow-Origin header and has no RV time-series table.
  DACE's API host (dace-api.unige.ch) did not resolve; its public RVs are served to its Python client.
  ESO's TAP (archive.eso.org/tap_obs) allows CORS but serves spectra, not velocities; HARPS velocities come
  from the HARPS RVBank below, which is the ESO archive re-reduced.

Every source is a VizieR catalogue with a star list carrying positions and a table of velocities. A search is two
requests per source: the star list by position (cone of a few arcsec around the host), then the velocities by the
catalogue's own star name. Each instrument era with its own zero point (CCD and fibre upgrades) becomes its own set.

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

VIZIER_MIRRORS ​

js
const VIZIER_MIRRORS
text
Radial velocities from public archives: which catalogues hold RV time series that a browser can fetch, how to ask
them, and how to read what they return. Pure: no DOM, no fetch. The caller passes a `fetchText(url)` function, so the
same code runs in a page, in Node (tests read saved responses from test/data/rv/) and in a worker.

What a browser can reach (checked 2026-11-16 with curl, Origin header set; see the report in test/rvsources.test.mjs):
  VizieR ASU (viz-bin/asu-tsv) on the CfA and IDIA mirrors answers with Access-Control-Allow-Origin: *. The CDS
  main site returned 404 for viz-bin that day and TAPVizieR timed out; both stay in the mirror list as fallbacks.
  NASA Exoplanet Archive TAP sends no Access-Control-Allow-Origin header and has no RV time-series table.
  DACE's API host (dace-api.unige.ch) did not resolve; its public RVs are served to its Python client.
  ESO's TAP (archive.eso.org/tap_obs) allows CORS but serves spectra, not velocities; HARPS velocities come
  from the HARPS RVBank below, which is the ESO archive re-reduced.

Every source is a VizieR catalogue with a star list carrying positions and a table of velocities. A search is two
requests per source: the star list by position (cone of a few arcsec around the host), then the velocities by the
catalogue's own star name. Each instrument era with its own zero point (CCD and fibre upgrades) becomes its own set.

RV_SOURCES ​

js
const RV_SOURCES

The catalogues searched. split cuts a set at the dates of instrument changes that shift the zero point ({ at: [BJD...], names: [...] }); group splits by a column (the Lick dewar). sameAs: a source holding the same observations (only one of them should enter a fit).

sourceById ​

js
const sourceById

No description in the source.

asuURL ​

js
function asuURL(base, params)

A VizieR ASU-TSV URL: base + /viz-bin/asu-tsv? + the parameters in order.

listQuery ​

js
function listQuery(src, ra, dec, { radius = 10, base = VIZIER_MIRRORS[0] } = {})

The star list of a source, searched within radius arcsec of (ra, dec) degrees J2000, nearest first.

dataQuery ​

js
function dataQuery(src, name, { base = VIZIER_MIRRORS[0] } = {})

Every velocity of one star of a source, by the catalogue's name for it.

parseASU ​

js
function parseASU(text)

Read a VizieR ASU-TSV response. Returns { status, message, tables: [{ name, columns, units, rows }] }: status 'ok' (at least one row), 'empty' (a valid answer with no rows), or 'error' (the server could not answer: a database connection error, an HTML error page, an unknown catalogue).

parseStarList ​

js
function parseStarList(text, src)

Stars of a star-list response: [{ name, sep (arcsec) }], nearest first.

parseRVTable ​

js
function parseRVTable(text, src, starName)

Velocities of one star from a data response: { sets: [{ name, instrument, t, v, e, n, span, medErr, era }], notes, dropped }. Times are absolute days (the source's time offset added), velocities and errors in m/s. Rows of other stars, rows without a velocity or a positive error, and flagged rows (HARPS RVBank) are left out and counted.

summarizeSet ​

js
function summarizeSet({ t, e })

n, span in days, first and last time, median error.

describeFailure ​

js
function describeFailure(err)

Why a request failed, in words: a browser reports a cross-origin refusal and a dead network alike as a TypeError ("Failed to fetch", "NetworkError when attempting to fetch resource", "Load failed"), with no status.

provenanceOf ​

js
function provenanceOf(src, set, { star, url, retrieved, mirror } = {})

Where a set came from, as stored with the dataset in the session.

findRadialVelocities ​

js
function async findRadialVelocities({ ra, dec, fetchText, sources = RV_SOURCES, mirrors = VIZIER_MIRRORS, radius = 10, now = ()

Ask every source for a star's velocities. ra, dec in degrees (J2000). fetchText(url) returns the body as text (or throws); each source tries the mirrors in turn until one gives a valid answer. Resolves with one entry per source: { source, status: 'found' | 'none' | 'error', star, sep, sets, notes, url, mirror, message }, and never rejects because of one source.

MIT licensed · Kyle A. Pearson