Skip to content

src/core/session.js ​

The ESL session: one JSON document that describes an analysis completely (the system, the data, what is free with which priors, the sampler settings) and, once run, its result. It is what the analyzer saves and exports, what the worked examples are stored as, and what the Python package and the assistant read and write. docs/FORMAT.md is the reference; this module turns a session into the specification buildProblem takes, runs it, and summarises the posterior. No DOM.

Times in a session are absolute (BJD or whatever the data use). Inside a fit they are measured from session.time_reference, so Julian dates keep their precision. Parameter keys are those of the analyzer: the first planet's are plain ("per"), later planets' carry their letter ("per@c"), epochs and velocity datasets their number ("a2@3", "jit@rv2").

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

FORMAT ​

js
const FORMAT

No description in the source.

planetSuffixes ​

js
const planetSuffixes

Key suffix of each planet: '' for the first, its letter for the others.

validateSession ​

js
function validateSession(s)

Throws a readable error when a document is not a usable session.

valuesFromSession ​

js
function valuesFromSession(s)

The flat table of parameter values (keys as in the analyzer, times relative to the reference).

specFromSession ​

js
function specFromSession(s, use)

The specification for buildProblem / runFit. use overrides session.fit.use, e.g. { lc: true, rv: true, timing: false }. Limb darkening that follows the star (mode "star") needs a table and is set up by the caller through spec.ldTie.

planetValuesOf ​

js
function planetValuesOf(values, sfx, kepler)

One planet's plain { rprs, ars, inc, per, tmid, ecc, omega, mplanet } out of the flat table.

summarizeFit ​

js
function summarizeFit(s, spec, res, { draws = 600, seed = 7 } = {})
text
Posterior summary of a finished run, in the session's own terms (times absolute again):
{ logZ, logZerr, information, ess, ncalls, converged, stop_reason, warnings,
  parameters: [{ key, label, unit, median, plus, minus, best }], derived: { key: { median, plus, minus } },
  best: { key: value }, chi2, chi2_parts, n_data, bic }
Derived quantities are those of the analyzer's system table, per planet ("K", "K@c", ...), from 600 posterior draws.
The stellar mass and radius are used as given (as fitted when they were free).

runSession ​

js
function async runSession(session, { onProgress = ()
text
Run a session's fit. Returns a copy of the session with `result` filled in (see summarizeFit), plus,
when keepSamples is true, result.samples = { keys, values: [[...], ...], weights: [...], logl: [...] }
with at most maxSamples equal-weight draws (times relative to time_reference, as sampled).

ldNames ​

js
const ldNames

Names of the limb darkening coefficients of a session's law.

MIT licensed · Kyle A. Pearson