Simon Biquard, Pierre Chanial, Wassim Kabalan
2024-12-19
pip install furax
(work in progress!)JAX
(see next slide)TOAST
, sotodlib
From the JAX website:
JAX is a library for array-oriented numerical computation (à la NumPy), with automatic differentiation and JIT compilation to enable high-performance machine learning research.
Key features
FURAX relies on PyTrees to represent the data.
Example: random sky with 3 components
sky = {
'cmb': HealpixLandscape(nside, 'IQU').normal(key1),
'dust': HealpixLandscape(nside, 'IQU').normal(key2),
'synchrotron': HealpixLandscape(nside, 'IQU').normal(key3),
}
HealpixLandscape(nside, 'IQU')
returns an instance of StokesIQUPyTree
, a container for the Stokes parameters I, Q, U.
Use FrequencyLandscape
to generalize to multiple frequencies.
The base class AbstractLinearOperator
provides a default implementation for the usual linear algebra operations.
Operation | FURAX | Comment |
---|---|---|
Addition | A + B |
|
Composition | A @ B |
|
Multiplication by scalar | k * A |
Returns the composition of a HomothetyOperator and A |
Transpose | A.T |
Through JAX autodiff, but can be overriden |
Inverse | A.I |
By default, the CG solver is used, but it can be overriden or configured using a context manager |
Block Assembly | BlockColumnOperator([A, B]) BlockDiagonalOperator([A, B]) BlockRowOperator([A, B]) |
Handle any PyTree of Operators: Block*Operator({'a': A, 'b': B}) |
Flattened dense matrix | A.as_matrix() |
|
Algebraic reduction | A.reduce() |
Generic Operator | Description |
---|---|
IdentityOperator |
|
HomothetyOperator |
|
DiagonalOperator |
|
BroadcastDiagonalOperator |
Non-square operator for broadcasting |
TensorOperator |
For dense matrix operations |
IndexOperator |
Can be used for projecting skies onto time-ordered series |
MoveAxisOperator |
|
ReshapeOperator |
|
RavelOperator |
|
SymmetricBandToeplitzOperator |
Methods: direct, FFT, overlap and save |
Block*Operator |
Block assembly operators (column, diagonal, row) |
Applied Operator | Description |
---|---|
QURotationOperator |
|
HWPOperator |
Ideal HWP |
LinearPolarizerOperator |
Ideal linear polarizer |
CMBOperator |
Parametrized CMB SED |
DustOperator |
Parametrized dust SED |
SynchrotronOperator |
Parametrized synchrotron SED |
Classic acquisition model with ideal linear polarizer \(\mathbf{M}_{\textrm{LP}}\), ideal half wave plate \(\mathbf{M}_{\textrm{HWP}}\), rotations \(\mathbf{R}\), pointing matrix \(\mathbf P\):
\[ \mathbf{H} = \mathbf{M}_{\textrm{LP}} \, \mathbf{R}_{2\theta} \, \mathbf{R}_{-2\phi} \, \mathbf{M}_{\textrm{HWP}} \, \mathbf{R}_{2\phi} \, \mathbf{R}_{2\psi} \, \mathbf{P} \]
where
is reduced automatically to the much simpler
\[ \mathbf{H} = \mathbf{M}_{\textrm{LP}} \, \mathbf{R}_{-2\theta + 4\phi + 2\psi}\, \mathbf{P} \]
Credits: Ema Tsang, Wassim Kabalan, Amalia Villarrubia & the whole SciPol team
Classic data model
\[ d = \mathbf{P}s + n \]
Optimal (GLS) solution
\[ \widehat{s} = (\mathbf{P}^\top \mathbf{N}^{-1} \mathbf{P})^{-1} \mathbf{P}^\top \mathbf{N}^{-1} d \]
Generalized parametric data model
\[ d_{\nu, i, t} = \int_{\textrm{BP}_\nu} d\nu' \mathbf{M}^{(\gamma)}_{\nu', i, t, p} \mathbf{A}^{(\beta)}_{\nu', t, c, p} s_{c, p} + n_{\nu, i, t} \]
Noise correlations in a stationary period correspond to a symmetric Toeplitz matrix structure.
SymmetricBandToeplitzOperator
with optimized matrix-vector operations in \(\mathcal O(n \log \lambda)\) (overlap-and-save method).
Restoring stationarity
To work around this problem, one solution is to fill the gaps with synthetic samples consistent with noise.
Furax’s GapFillingOperator
computes a constrained noise realization from an estimate of the noise correlations.
Realistic HWP operator
Cf. great presentation by Miguel Gomes yesterday!
tldr: Does everything fgbuster
does, but better
Beyond fgbuster
Cost of evaluating the likelihood function is reduced by a factor 10 for \(\textrm{nside} \geq 64\).
This will power the map-based pipeline for \(r\) estimation in SO (cf. presentation by Baptiste Jost earlier today).
Goal: For the Simons Observatory, characterize the observed atmospheric template from the recorded time-ordered data to separate the atmosphere from the sky signal we are after.
Detector array scanning the sky (signal has arbitrary units)
Data Model
\[ d_{\text{atm}} = \mathbf{A}(\text{pwv}) \mathbf{P}(\vec{w}) s_{\text{atm}} + n \]
with parameters:
Estimate parameters by minimizing the spectral likelihood.
\[ \boxed{ \langle \delta \mathcal{S}_\text{spec}(\vec{w}, \text{pwv} \mid d_{\text{atm}}) \rangle = d_{\text{atm}}^\top \cdot \mathbf{AP} \Big[ (\mathbf{AP})^\top \mathbf{N}^{-1} (\mathbf{AP}) \Big]^{-1} (\mathbf{AP})^\top \mathbf{N}^{-1} d_{\text{atm}} } \]
Spectral likelihood values in the \((w_x, w_y)\) plane for a fixed PWV value.
Minimization is done by brute force: we compute \(\langle \delta \mathcal{S}_\text{spec}(w_x, w_y \mid \text{pwv}_{\text{sim}}) \rangle\) for 22,500 different combinations of \((w_x, w_y)\).
Proof of concept: we can recover the wind parameters!
Future work:
jax
for performance and portabilityIf you are interested, check out our the repository on GitHub: CMBSciPol/furax.
This work is part of the ERC project SciPol (https://scipol.in2p3.fr/).