Skip to content

Commit f4fe212

Browse files
committed
feat(docs): improve baseline modeling explanation and update theming
- Refined and condensed explanations in `baseline_modeling.rst` for better clarity and conciseness. - Introduced a new custom CSS file for improved documentation design, including centered math rendering. - Updated `conf.py` to include `custom.css` and configure centered MathJax alignment.
1 parent 7c619f0 commit f4fe212

File tree

4 files changed

+50
-45
lines changed

4 files changed

+50
-45
lines changed

doc/source/_static/css/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ blocks.frontpage > h1 {
88
font-weight: 300;
99
padding-top: 0.5em;
1010
padding-bottom: 0.5em;
11-
}
11+
}

doc/source/_static/custom.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* ExoIris: fast, flexible, and easy exoplanet transmission spectroscopy in Python.
3+
* Copyright (C) 2026 Hannu Parviainen
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
div.math {
20+
text-align: center;
21+
}

doc/source/conf.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
extensions = [
1414
'sphinx.ext.autodoc',
1515
'sphinx.ext.autosummary',
16-
# 'sphinx_automodapi.automodapi',
1716
'sphinx.ext.mathjax',
1817
'sphinx.ext.intersphinx',
19-
'sphinx.ext.imgmath',
2018
'sphinx.ext.viewcode',
2119
'sphinx.ext.githubpages',
2220
'sphinx.ext.napoleon',
@@ -35,15 +33,18 @@
3533

3634
pygments_style = 'sphinx'
3735

38-
#html_theme = 'furo'
3936
html_theme = 'sphinx_book_theme'
40-
#html_theme = 'pydata_sphinx_theme'
41-
4237
html_title = f'ExoIris v{version}'
43-
html_theme_options = {
44-
'sidebar_hide_name': False,
45-
}
4638
html_static_path = ['_static']
39+
html_css_files = [
40+
'custom.css',
41+
]
42+
43+
mathjax3_config = {
44+
'chtml': {
45+
'displayAlign': 'center',
46+
},
47+
}
4748

4849
default_role = 'py:obj'
4950

doc/source/features/baseline_modeling.rst

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,37 @@ ExoIris describes the observed flux at each wavelength channel as
1818
where :math:`\boldsymbol{\Phi}` is an :math:`n_t \times k` covariate (design) matrix and
1919
:math:`\mathbf{c}(\lambda)` is a vector of per-wavelength baseline coefficients. The first column of
2020
:math:`\boldsymbol{\Phi}` is always a column of ones that captures the out-of-transit flux level; the
21-
remaining columns describe systematic trends.
22-
23-
The covariates can be:
24-
25-
- **Time polynomials** --- the default when no custom covariates are supplied. ``TSData`` automatically
26-
builds a design matrix with columns :math:`1, \hat{t}, \hat{t}^2, \ldots`, where :math:`\hat{t}` is
27-
centred and normalised time, up to the order set by ``n_baseline``.
28-
- **Measured auxiliary variables** such as detector temperature, pointing drift, airmass, or
29-
PSF width, recorded simultaneously with the spectroscopic time series.
30-
- **Common-mode systematics** extracted from the observations (e.g., wavelength-independent trends
31-
derived from the white light curve residuals).
32-
- **Any user-supplied matrix** passed via the ``covs`` parameter of :class:`~exoiris.tsdata.TSData`.
33-
When ``covs`` is provided it replaces the default polynomial construction entirely, so it should
34-
include a constant (ones) column if an additive offset is desired.
21+
remaining columns describe systematic trends. The covariates can be time polynomials (the default),
22+
measured auxiliary variables such as detector temperature or pointing drift, common-mode systematics
23+
extracted from the white light curve residuals, or any user-supplied matrix that replaces the default
24+
polynomial construction entirely.
3525

3626
Profiled Baseline
3727
-----------------
3828

39-
When the noise model is set to ``white_profiled`` (the default), ExoIris estimates the baseline
40-
coefficients :math:`\mathbf{c}(\lambda)` by ordinary linear least squares at every likelihood
41-
evaluation. Concretely, given the current transit model :math:`F_\mathrm{transit}`, the residual
42-
:math:`F_\mathrm{obs} / F_\mathrm{transit}` is regressed against :math:`\boldsymbol{\Phi}` to obtain
43-
the best-fit coefficients, which are then multiplied back into the transit model. Because the
44-
coefficients are determined analytically at each step, they are *profiled out* of the likelihood and
45-
add no extra parameters to the MCMC sampler. This keeps the parameter space compact and speeds up
46-
convergence.
29+
In the default profiled mode, ExoIris estimates the baseline coefficients by ordinary linear least
30+
squares at every likelihood evaluation. The residual between the data and the current transit model is
31+
regressed against the design matrix, and the resulting best-fit coefficients are folded back into the
32+
model. Because the coefficients are determined analytically at each step, they are *profiled out* of the
33+
likelihood and add no extra parameters to the sampler. This keeps the parameter space compact and speeds
34+
up convergence.
4735

4836
Analytically Marginalized Baseline
4937
-----------------------------------
5038

51-
Setting the noise model to ``white_marginalized`` activates Bayesian analytic marginalisation of the
52-
baseline coefficients. Instead of plugging in point estimates, ExoIris integrates the coefficients out
53-
under a broad isotropic Gaussian prior :math:`\mathbf{c} \sim \mathcal{N}(\mathbf{0},\,\tau^2 \mathbf{I})`
54-
with :math:`\tau = 10^6`. The marginal likelihood is
39+
As an alternative, ExoIris can analytically marginalise the baseline coefficients under a broad Gaussian
40+
prior instead of plugging in point estimates. The marginal likelihood integrates the coefficients out in
41+
closed form,
5542

5643
.. math::
5744
5845
\mathcal{L}(\theta) = \int p\!\left(F_\mathrm{obs} \mid \theta, \mathbf{c}\right)\, p(\mathbf{c})\, \mathrm{d}\mathbf{c}
5946
60-
which can be evaluated in closed form because the model is linear in :math:`\mathbf{c}`. Defining
61-
:math:`\boldsymbol{\Phi}_m = \mathrm{diag}(F_\mathrm{transit}) \, \boldsymbol{\Phi}`, the marginal
62-
covariance of the data is :math:`C = \Sigma + \tau^2 \boldsymbol{\Phi}_m \boldsymbol{\Phi}_m^\top`,
63-
where :math:`\Sigma = \mathrm{diag}(\sigma^2)`. ExoIris evaluates :math:`C^{-1}` and
64-
:math:`\lvert C \rvert` efficiently using the Woodbury matrix identity and the matrix determinant
65-
lemma, working with :math:`k \times k` matrices rather than :math:`n_t \times n_t` matrices.
47+
because the model is linear in :math:`\mathbf{c}`. The resulting covariance is evaluated efficiently via
48+
the Woodbury matrix identity and the matrix determinant lemma, keeping the cost proportional to the
49+
number of covariates rather than the number of time points.
6650

6751
Compared to the profiled approach, marginalisation properly propagates baseline uncertainty into the
68-
posterior distributions of all transit parameters. The transit model is evaluated *without* a baseline
69-
factor; the likelihood accounts for the baseline analytically. This can yield more conservative---and
70-
more accurate---uncertainty estimates, particularly when the covariate model is flexible or the
71-
out-of-transit coverage is limited.
52+
posterior distributions of all transit parameters. This can yield more conservative---and more
53+
accurate---uncertainty estimates, particularly when the covariate model is flexible or the out-of-transit
54+
coverage is limited.

0 commit comments

Comments
 (0)