High-resolution retrievals¶
In addition to the classic low-resolution forward models, BeAR can perform retrievals on high-resolution cross-correlation spectroscopy. This mode targets ground-based, high-resolving-power time series (e.g. CRIRES+, IGRINS, SPIRou) in which the planetary signal is not measured as an absolute flux but is instead extracted from the Doppler shift of thousands of individual spectral lines as the planet moves along its orbit.
BeAR implements this following the now-standard cross-correlation-to-likelihood mapping of Brogi & Line (2019), with the per-pixel-uncertainty extension of Gibson et al. (2022) and an optional CHIMERA-style signal re-injection scheme.
Note
The high-resolution workflow is under active development. The interface
described here corresponds to the current dev_highres branch.
Overview¶
High-resolution retrievals in BeAR are driven by two ingredients:
one or more observations flagged with the
high_resolutionmodifier inobservations.list(see High-resolution observations for the data-file format), anda forward model that provides a high-resolution spectrum. This is primarily the Phase curve (high-resolution) model, which produces both a low-resolution occultation spectrum and a high-resolution planet-to-star flux ratio \(F_\mathrm{p}/F_\mathrm{s}\). The transmission model can also be used with high-resolution observations; in that case the transit depth is converted to a signal \(-\delta\) (in ppm) that is cross-correlated with the data. The separate
opacity_highresblock is, however, only available for the phase-curve model.
When at least one high-resolution observation is present, BeAR builds a dual
spectral grid: the normal low-resolution grid (set by spectral_resolution)
and a separate high-resolution grid (set by spectral_resolution_highres in
retrieval.toml). The high-resolution grid is used for the line-by-line model
that enters the cross-correlation likelihood, and it may use its own opacity
tables via the opacity_highres block (see Separate opacity sources for the high-resolution model).
The presence of high-resolution observations also automatically appends a small set of retrieval parameters — the high-resolution tail — to the forward model’s own parameters. These are described below.
The orbital-velocity model¶
The planetary lines are shifted, exposure by exposure, by the line-of-sight velocity of the planet. BeAR models the radial velocity at orbital phase \(\phi\) as
where \(v_\mathrm{bary}\) is the per-exposure barycentric velocity
taken from the data file (#barycentric_velocities; zero if the user has
already applied the correction in pre-processing). Note that this value is
added to the radial velocity, so the sign convention of the values in the
data file has to be chosen accordingly. The high-resolution wavelength grid is
automatically extended by \(\pm 300\,\mathrm{km\,s^{-1}}\) beyond the range
of the observations to accommodate the Doppler shifts. Only the planetary flux \(F_\mathrm{p}\) is Doppler-shifted
by \(v_\mathrm{rad}\); the stellar flux \(F_\mathrm{s}\) is kept at rest,
with a per-pixel correction factor \(F_\mathrm{s}(\lambda\,v_\mathrm{dop})
/F_\mathrm{s}(\lambda_\mathrm{rest})\) applied to undo the shift that the
\(F_\mathrm{p}/F_\mathrm{s}\) ratio would otherwise impose on the stellar
component.
The three retrieval parameters that control this model are the high-resolution tail priors:
Prior name |
Meaning |
|---|---|
|
Radial-velocity semi-amplitude \(K_p\), added as an offset to the
reference value |
|
Systemic velocity \(V_\mathrm{sys}\), added as an offset to the
reference value |
|
Orbital-phase offset \(\Delta\phi\) (in units of orbital phase). |
Because kp and vsys are offsets from the reference values, a
well-centred prior is a narrow interval around zero. If kp_ref and
vsys_ref are absent from the data file they default to zero, recovering the
older behaviour in which kp and vsys are retrieved directly.
Exposure (velocity) blurring¶
During a finite exposure the planet’s line-of-sight velocity drifts, so the recorded spectrum is the time-average of the instantaneous, Doppler-shifted spectrum. BeAR models this smearing as a top-hat (boxcar) in velocity of full width
which is maximal at conjunction (transit/eclipse) and vanishes at quadrature. Here \(P\) is the orbital period and \(t_\mathrm{exp}\) the exposure integration time. The running mean of the model over this velocity interval is evaluated from a precomputed cumulative trapezoidal integral of the model, so the cost is \(O(1)\) per pixel and independent of the box width.
Exposure blurring is enabled automatically when both #orbital_period
(in days) and #exposure_times (per-exposure, in seconds) are present in the
high-resolution data file (see High-resolution observations). If either is
absent, no blurring is applied. If the number of values in #exposure_times
does not match #nb_exposures, a warning is printed and blurring is disabled.
Exposures with a negligible velocity drift (\(|\Delta v| < 10^{-3}\)
km/s) are not blurred.
Model filtering and re-injection¶
Ground-based high-resolution spectra are dominated by telluric and stellar features that vary slowly in time. These are typically removed with a data-detrending step (e.g. SysRem or an SVD/PCA decomposition), which projects out the strongest time-correlated modes. To compare model and data on an equal footing, the same operator must act on the model.
BeAR loads a per-order basis \(U\) of the dominant temporal modes
(#filtering_basis / #nb_basis_vectors), augments it with a constant
column (mean removal), and constructs the projection matrix
where \(\Lambda\) is a diagonal matrix with the inverse of the per-exposure
mean uncertainties (#uncertainties; the identity matrix if absent). The
operator \((I - P)\) removes the temporal modes. Two behaviours are
available:
Filtered model (
#filter_model 1, the default): the \((I - P)\) operator is applied to both the data (once, when the file is loaded) and the model (for every likelihood evaluation). Afterwards, both the filtered data and the filtered model are additionally detrended per exposure by removing a quadratic polynomial in pixel index. The likelihood is evaluated per order and exposure. This is the standard Gibson et al. (2022) fast model-filtering approach.Data-only filtering (
#filter_model 0): \((I - P)\) is applied only to the data (without the subsequent detrending), while the model is centred in time by subtracting its temporal mean per pixel. The cross-correlation sums are accumulated over all exposures of an order before the logarithm is taken, i.e. one likelihood term per order. Since the model does not undergo the distortion that the filter imposes on the data, this mode should be regarded as a diagnostic rather than an unbiased likelihood.
Note
On the GPU, the filtered mode currently supports at most 512 exposures per observation. Larger data sets have to be split into several observation files.
CHIMERA-style re-injection (#reinject_model 1) embeds the model planet
signal into the detector-unit background before filtering: the model
\(F_\mathrm{p}/F_\mathrm{s}\) is multiplied by the SVD-captured background
\(S = P\,D\), computed from the raw (not detrended) data \(D\) when the
file is loaded, and then passed through \((I - P)\). This
reproduces the way a real planet signal is attenuated by the detrending. Since
\((I-P)S = 0\) by construction, only the planetary lines survive the
projection. Re-injection requires a #filtering_basis section and
#filter_model 1; BeAR aborts with an error otherwise. It is also strongly
recommended to retrieve the line-contrast parameter alpha (see below), since
otherwise the absolute line amplitude is not constrained; BeAR only prints a
warning in this case. If a #model_scale section is present as well, it is
ignored in favour of \(S = P\,D\). For re-injection, the stellar spectrum
that enters \(F_\mathrm{p}/F_\mathrm{s}\) should be smooth, which is achieved
with the highres_stellar_smooth_sigma option of the phase-curve model (see
Stellar spectra).
Finally, a dayside phase function
following Herman et al. (2022)
and Pelletier et al. (2025), can be applied per exposure to the
model by setting #phase_function 1 in the data file. Here, \(\phi = 0\)
corresponds to the transit, such that \(w = 1\) at secondary eclipse,
\(1/4\) at quadrature, and \(0\) at transit. This weights the dayside
emission contribution with orbital phase, as appropriate for a phase-curve
observation. The weight is applied in all filtering modes, before the
\((I - P)\) projection where applicable.
Likelihood¶
BeAR maps the cross-correlation between model and data to a likelihood using one
of three modes. The mode is selected automatically from whether the line
contrast parameter alpha is a free parameter and whether the data file
provides per-pixel flux uncertainties:
Mode |
|
Per-pixel \(\sigma\)? |
Description |
|---|---|---|---|
|
no |
not used |
Brogi & Line (2019); both the line-contrast scaling and the noise scale
are analytically marginalized. Default when no |
|
yes |
no |
Brogi & Line (2019) with an explicit line-contrast factor |
|
yes |
yes |
Gibson et al. (2022), Eq. 4; per-pixel uncertainties with the noise scaling \(\beta\) marginalized. |
For the Brogi & Line modes, the per-exposure log-likelihood over \(N\) pixels is
where \(s_f^2\) and \(s_g^2\) are the data and model variances and
\(R\) is their cross-covariance. Internally, BeAR evaluates the equivalent,
normalised form \(\log L = -\tfrac{N}{2}\log\!\big(1 + (\alpha^2 s_g^2 -
2\alpha R)/s_f^2\big)\), which differs from the expression above only by a
constant and yields \(\log L = 0\) for a model that is uncorrelated with the
data. In the marginalized_alpha mode this
reduces to \(\log L = -\tfrac{N}{2}\log\!\big(1 - R^2/(s_f^2 s_g^2)\big)\),
i.e. a monotonic function of the cross-correlation coefficient. In the
free_alpha mode \(\alpha\) is retrieved and directly measures the
absolute strength (line contrast) of the planetary lines relative to the model.
The gibson mode instead evaluates a \(\chi^2\) built from the per-pixel
uncertainties,
with the weighted sums \(S_1 = \sum_i 1/\sigma_i^2\),
\(S_f = \sum_i f_i/\sigma_i^2\), and analogously for the model, precomputed
once per observation. The sums are computed from the filtered fluxes but with the
original per-pixel uncertainties. Note that the gibson mode is only selected
if alpha is a free parameter; #flux_uncertainties present in a data file
are ignored otherwise.
The alpha parameter¶
The line-contrast parameter alpha becomes a free retrieval parameter iff
a prior named alpha is present in priors.config. This single switch
determines the likelihood mode (see the table above) and, together with
filter_model, enables re-injection. Retrieving alpha allows the absolute
line contrast to be measured rather than assumed, at the cost of one extra
parameter; leaving it out selects the fully marginalized Brogi & Line
likelihood, which is scale-free.
Numerical precision of the marginalized_alpha mode on the GPU¶
The GPU evaluates the high-resolution model in single precision, the CPU in
double precision. For the free_alpha and gibson modes and for the
data-only mode both agree to about \(10^{-5}\) of the log-likelihood.
The marginalized_alpha mode can differ by more, because it is scale-free:
only the shape of the model after the temporal filter \((I - P)\) and the
quadratic detrending enters, not its amplitude. For models with weak planetary
lines, the part of the model that survives the filter can be as small as
\(10^{-7}\) of the raw model, which is below the resolution of a
single-precision spectrum. The GPU residual is then dominated by rounding noise,
\(s_g^2\) is overestimated and the GPU log-likelihood falls below the CPU
value. In a test retrieval setup (WASP-77Ab with IGRINS, 44 orders, 79
exposures), the two paths differed by 0.4% of the total log-likelihood at a
typical parameter point and by up to 8% at a point with very low line contrast,
while the underlying model matrices agreed to \(2\times10^{-7}\).
In practice this only affects parameter regions in which the marginalized
likelihood is amplitude-degenerate anyway (the CPU assigns such a model the same
likelihood as a strong-lined one with the same line pattern), and the GPU
effectively penalises them. If a scale-free likelihood with the exact
double-precision behaviour is required, run the retrieval on the CPU; otherwise
the free_alpha mode, which re-injection requires in any case, is unaffected.
Modules¶
Modules are optional forward-model components that post-process the computed
spectrum. They are configured with a modules array in forward_model.toml
(available for the transmission and phase-curve models), e.g.
modules = [
{ model = "velocity_broadening", params = [] },
]
The velocity_broadening and phase_resolved_broadening modules take no
configuration params of their own, while stellar_contamination requires
the description of a stellar spectrum model in its params (see below). Each
module exposes a set of free retrieval parameters (name-keyed priors, listed
below).
Velocity broadening¶
velocity_broadening convolves the spectrum with a combined rotational and
instrumental kernel. Its four priors are:
Prior name |
Meaning |
|---|---|
|
Projected rotational velocity \(v \sin i\) (km/s). |
|
Instrumental Gaussian broadening width (km/s). |
|
Linear limb-darkening coefficient of the rotational kernel. |
|
Additional (super-rotation) wind broadening velocity (km/s), added in quadrature to the instrumental Gaussian width. |
The rotational kernel follows Gray (2005) with a linear limb-darkening law. The convolution is carried out in velocity space on the (non-uniform) wavenumber grid, i.e. the kernel is evaluated with the actual velocity step of each grid point. Kernels narrower than the local grid spacing are skipped; the Gaussian is truncated at \(5\sigma\).
Phase-resolved broadening¶
phase_resolved_broadening applies the limb-darkened transit kernel of
Brogi et al. (2016)
(their Sect. 4.2), which accounts for planetary rotation and super-rotation
winds (within \(\pm 25^\circ\) latitude) across the annulus of the planet
that is probed during transit, including the quadratic limb darkening of the
star. Despite its name, the kernel is currently static: it is constructed once
from the transit geometry and applied to the spectrum as a whole, not separately
for each exposure. Its seven priors are:
Prior name |
Meaning |
|---|---|
|
Equatorial rotation velocity (km/s). |
|
Equatorial super-rotation wind velocity (km/s). |
|
Instrumental Gaussian broadening width (km/s). |
|
First quadratic stellar limb-darkening coefficient. |
|
Second quadratic stellar limb-darkening coefficient. |
|
Planet-to-star radius ratio. |
|
Transit impact parameter (in stellar radii). |
Stellar contamination¶
stellar_contamination models the transit light source effect of unocculted
spots and faculae. Its params array has to contain the stellar spectrum model
and its parameters, e.g. params = ["grid", "/data/phoenix_grid/"] (see
Stellar spectra). In addition to the underlying stellar-model parameters
(prefixed tls_), it exposes four priors:
Prior name |
Meaning |
|---|---|
|
Faculae temperature offset, added to the stellar effective temperature. |
|
Spot temperature offset, subtracted from the stellar effective temperature. |
|
Faculae covering fraction. |
|
Spot covering fraction. |
Prior summary¶
For a high-resolution retrieval the priors.config file must contain, in
addition to the forward model’s own parameters (see
Phase curve (high-resolution)):
the high-resolution tail
kp,vsys,dphi(always), andoptionally
alpha(only if you want to retrieve the line contrast), plusany priors required by the modules listed in
forward_model.toml.
As everywhere in BeAR, these are matched by name and may be listed in any order (see Prior distributions).