src/core/lcfits.js
Light curves stored as FITS binary tables: TESS and Kepler/K2 light-curve files (SPOC, TESS-SPOC, QLP, K2SFF, EVEREST, ...) and any table with a time column and a flux column. The result is CSV text that the analyzer's parseLightCurve reads like any other file, so every later step is shared.
Import: import { … } from './src/core/lcfits.js' — no DOM, runs in Node and the browser.
lightCurveFromFits
js
function async lightCurveFromFits(buffer, opts = {})text
Read a light curve from a FITS file (ArrayBuffer, gzip allowed).
Time: TIME with BJDREFI + BJDREFF (TESS: BTJD = BJD_TDB - 2457000; Kepler: BKJD = BJD_TDB - 2454833), or a column
named for its system. Cadences with a non-zero QUALITY flag (opts.quality 'default'; 'none' keeps them), non-finite
time or flux are dropped. Flux is divided by its median (errors too).
opts.quality: undefined or 'any' drops a cadence with any QUALITY bit set (the analyzer's behaviour); 'none' keeps
them; 'default' | 'hard' | 'hardest' use lightkurve's bitmask for the mission (src/core/lcprep.js); a number is a bitmask.
The result also carries `arrays` (the kept rows: time in BJD, the column's flux and error before normalising, QUALITY),
which the photometry page stitches sector by sector.- param opts { flux: column name to use, quality, hdu: index }
- returns { csv, meta: { object, mission, sector, quarter, campaign, author, fluxColumn, timeColumn, bjdRef, timeSystem, kept, dropped: { quality, nonfinite }, columns: [names], ra, dec, exptime } }
looksLikeFits
js
function looksLikeFits(buf)True when the bytes look like FITS (a "SIMPLE =" card) or gzip.