Operators¶
These functions evaluate the EoR and foreground operators as JAX arrays. They do not read files, choose hardware or apply priors, so they can be used inside compiled code. For full-size operators saved to disk, see construction.
Main interface¶
T_21 and T_fg build a block of each operator from the sky geometry, baselines
and beam. T_fg_weighted applies the prior and noise weighting used by the
KL reduced basis.
Linear operators used in BayesEoR's interferometric forward model.
The component models share the beam-weighted measurement operator \(R = F^{-1}P\) and differ in how their coefficients define sky brightness:
build_transverse_fourier_operator constructs F' (uv to image),
build_spectral_fourier_operator constructs F_z (eta to frequency),
and build_foreground_spectral_operator supplies the spectral part of
Q_z. build_sky_to_visibility_operator constructs R, including
the pixel solid angle and primary beam. T_21 and T_fg compose the
response and component factors for supplied blocks of visibility rows.
These functions perform numerical construction only. Geometry modules define
the coordinates; construction/operator_construction.py chooses CPU blocks, distributes
their construction, and saves the assembled matrices. BuildMatrices
supplies the configured input arrays. The compact factors below implement
these products without forming full Kronecker matrices. T_fg_weighted
additionally applies supplied prior and noise factors to prepare the foreground
operator for decomposition. No unit conversion or KL compression is applied.
T_21
¶
T_21(lmn: Array, uvw_lambda: Array, beam: Array, pixel_area_sr: float, transverse_operator: Array, spectral_operator: Array) -> jax.Array
Evaluate the cosmological coefficient-to-visibility operator on supplied samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmn
|
Array
|
Cosmological pixel directions, shape |
required |
uvw_lambda
|
Array
|
Selected baselines in wavelengths, shape |
required |
beam
|
Array
|
Horizon-masked power gains, shape |
required |
pixel_area_sr
|
float
|
Equal-area pixel solid angle in steradians. |
required |
transverse_operator
|
Array
|
Selected columns of F', shape |
required |
spectral_operator
|
Array
|
Selected frequency rows and eta columns of F_z, shape
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
operator |
Array
|
T_21 = F^-1 P F' F_z, shape
|
Notes
Pass matching subsets of observing times, frequencies, baselines and
Fourier modes to evaluate a block. Retain all image pixels needed for the
cosmological integral: dropping pixels changes the model rather than
merely selecting coefficient columns. This function is JAX-native and
can be composed inside jax.jit or automatic differentiation. It does
not select a device, access files, distribute work, or apply KL reduction.
T_fg
¶
T_fg(lmn: Array, uvw_lambda: Array, beam: Array, pixel_area_sr: float, spectral_operator: Array) -> jax.Array
Evaluate the foreground coefficient-to-visibility operator on supplied samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmn
|
Array
|
Selected foreground pixel directions, shape |
required |
uvw_lambda
|
Array
|
Selected baselines in wavelengths, shape |
required |
beam
|
Array
|
Horizon-masked power gains, shape |
required |
pixel_area_sr
|
float
|
Equal-area pixel solid angle in steradians. |
required |
spectral_operator
|
Array
|
Selected frequency rows and component columns of Q, shape
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
operator |
Array
|
T_fg = F^-1 P Q_z, shape
|
Notes
Select matching input arrays before calling to evaluate only the required
visibility rows and component/pixel columns. The function is JAX-native
and can be used inside jax.jit or automatic differentiation without
saving a matrix. It performs no device selection, distributed scheduling,
prior weighting, or KL reduction.
T_fg_weighted
¶
T_fg_weighted(lmn: Array, uvw_lambda: Array, beam: Array, pixel_area_sr: float, spectral_operator: Array, *, prior_sqrt: Array, noise_whitener: Array) -> jax.Array
Evaluate the prior- and noise-weighted physical foreground mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmn
|
Array
|
Foreground pixel directions, shape |
required |
uvw_lambda
|
Array
|
Baselines in wavelengths, shape |
required |
beam
|
Array
|
Horizon-masked gains, shape |
required |
pixel_area_sr
|
float
|
Equal-area pixel solid angle in steradians. |
required |
spectral_operator
|
Array
|
Foreground spectral factors, shape |
required |
prior_sqrt
|
Array
|
Prior standard deviations in component/pixel order, or a square
covariance factor, as defined in |
required |
noise_whitener
|
Array
|
Inverse noise RMS in time/frequency/baseline order, or a square
whitening matrix, as defined in |
required |
Returns:
| Name | Type | Description |
|---|---|---|
weighted_operator |
Array
|
|
Notes
Composes the unchanged physical T_fg with prior weighting and noise
whitening. It is JAX-native, including under jax.jit and automatic
differentiation; distribution, saving and decomposition remain separate.
To reuse an already constructed matrix, call weight_foreground_operator
instead. Correlated factors require complete contracted axes, as described
there; diagonal factors permit independently evaluated visibility blocks.
Building blocks¶
Each factor of the operators can also be built separately: the fringe response, \(\mathbf R = \mathbf F^{-1}\mathbf P\); the Fourier transforms, \(\mathbf F'\) and \(\mathbf F_z\); and the foreground spectral basis, \(\mathbf Q_z\).
Linear operators used in BayesEoR's interferometric forward model.
The component models share the beam-weighted measurement operator \(R = F^{-1}P\) and differ in how their coefficients define sky brightness:
build_transverse_fourier_operator constructs F' (uv to image),
build_spectral_fourier_operator constructs F_z (eta to frequency),
and build_foreground_spectral_operator supplies the spectral part of
Q_z. build_sky_to_visibility_operator constructs R, including
the pixel solid angle and primary beam. T_21 and T_fg compose the
response and component factors for supplied blocks of visibility rows.
These functions perform numerical construction only. Geometry modules define
the coordinates; construction/operator_construction.py chooses CPU blocks, distributes
their construction, and saves the assembled matrices. BuildMatrices
supplies the configured input arrays. The compact factors below implement
these products without forming full Kronecker matrices. T_fg_weighted
additionally applies supplied prior and noise factors to prepare the foreground
operator for decomposition. No unit conversion or KL compression is applied.
build_sky_to_visibility_operator
¶
build_sky_to_visibility_operator(lmn: Array, uvw_lambda: Array, beam: Array, pixel_area_sr: float) -> jax.Array
Map individual HEALPix pixel brightnesses to measured visibilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmn
|
Array
|
Topocentric sky coordinates with shape |
required |
uvw_lambda
|
Array
|
Baselines in observing wavelengths with shape
|
required |
beam
|
Array
|
Horizon-limited primary-beam power response with shape
|
required |
pixel_area_sr
|
float
|
Solid angle of one equal-area sky pixel in steradians. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Beam-weighted sky-to-visibility response with shape
|
Notes
At each observing time, propagate the pixels' topocentric (l, m, n) directions through the full three-dimensional discrete Fourier response, including primary-beam weighting and pixel solid angle. The combined operator is \(R=F^{-1}P\).
Summing R[t, f, b, p] * brightness[f, p] over pixels gives a model
visibility. Both sky components use this response, restricted to their
respective pixel selections. F^{-1} denotes the sky-to-visibility
Fourier operator; it does not imply a numerical matrix inversion here.
build_transverse_fourier_operator
¶
build_transverse_fourier_operator(uv: Array, lm: Array, uv_cell_area: float) -> jax.Array
Map cosmological (u, v) coefficients to brightness at HEALPix pixel centres.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uv
|
Array
|
Retained model coordinates, shape |
required |
lm
|
Array
|
Image direction cosines, shape |
required |
uv_cell_area
|
float
|
Fourier-cell integration weight |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Complex matrix of shape |
Notes
This transverse Fourier operator is denoted \(F'\).
build_spectral_fourier_operator
¶
build_spectral_fourier_operator(eta: Array, frequency_offsets_hz: Array, d_eta: float) -> jax.Array
Map cosmological eta coefficients to brightness at observing frequencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eta
|
Array
|
Retained line-of-sight Fourier coordinates in inverse Hz (seconds),
shape |
required |
frequency_offsets_hz
|
Array
|
Frequencies relative to the chosen reference channel, in Hz, shape
|
required |
d_eta
|
float
|
Fourier integration weight in inverse Hz, normally |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Complex matrix of shape |
Notes
This line-of-sight Fourier operator is denoted \(F_z\).
build_foreground_spectral_operator
¶
build_foreground_spectral_operator(frequencies_mhz: Array, reference_frequency_mhz: float, spectral_indices: Sequence[float] = (-2.63, -2.82)) -> jax.Array
Map a pixel's foreground amplitudes to its brightness spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies_mhz
|
Array
|
Observing frequencies in MHz, shape |
required |
reference_frequency_mhz
|
float
|
Positive reference frequency |
required |
spectral_indices
|
sequence of float
|
Signed exponents for the power-law components, following the constant
component. For example, |
(-2.63, -2.82)
|
Returns:
| Type | Description |
|---|---|
Array
|
Dimensionless complex matrix of shape
|
Notes
These constant and power-law factors define the spectral part of \(Q_z\), shared by every foreground HEALPix pixel.
build_T_21_core
¶
build_T_21_core(sky_to_visibility: Array, transverse_operator: Array, spectral_operator: Array) -> jax.Array
Map cosmological (u, v, eta) amplitudes to a block of visibilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sky_to_visibility
|
Array
|
|
required |
transverse_operator
|
Array
|
|
required |
spectral_operator
|
Array
|
|
required |
Returns:
| Type | Description |
|---|---|
Array
|
Matrix of shape |
Notes
Reconstruct their brightness on the cosmological HEALPix selection and propagate it through the beam-weighted three-dimensional fringe response, implementing \(T_{21}=R F' F_z\).
core denotes the equation-level calculation for supplied arrays.
T_21_build_save handles distributed CPU construction and saving.
All integration weights are already included in the input operators.
build_T_fg_core
¶
build_T_fg_core(sky_to_visibility: Array, spectral_operator: Array) -> jax.Array
Map spectral foreground amplitudes at each HEALPix pixel to visibilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sky_to_visibility
|
Array
|
|
required |
spectral_operator
|
Array
|
Spectral factors |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Matrix of shape |
Notes
Evaluate each pixel's brightness at the observing frequencies and apply the beam-weighted three-dimensional fringe response, implementing \(T_{\rm FG}=R Q_z\).
Each foreground coefficient belongs to one image pixel and one spectral
component. Q supplies the spectral dependence at every pixel;
R propagates the resulting brightness through the instrument.
T_fg_build_save distributes and saves blocks from this core.
The pixel identity in Q_z is applied implicitly, so no dense
Kronecker product or additional pixel-area factor is needed.
weight_foreground_operator
¶
weight_foreground_operator(operator: Array, prior_sqrt: Array, noise_whitener: Array) -> jax.Array
Prior-weight and noise-whiten a foreground coefficient-to-visibility matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operator
|
Array
|
Physical foreground operator, shape |
required |
prior_sqrt
|
Array
|
Factor |
required |
noise_whitener
|
Array
|
Factor |
required |
Returns:
| Name | Type | Description |
|---|---|---|
weighted_operator |
Array
|
|
Notes
With Hermitian covariance roots this is
Thus an SVD of A or eigendecomposition of A @ A.conj().T can
recover its noise-relevant visibility modes. This function only applies
the factors: it does not construct a covariance, decompose, truncate,
save, or choose a device. The caller supplies valid covariance factors;
shape checks remain compatible with jax.jit and differentiation.
Prior means affect the predicted mean, not this uncertainty operator.
For diagonal factors, matching row/column subsets can be weighted independently. Dense factors mix rows/columns and require the complete contracted axes; slicing their diagonal blocks generally changes the model.
build_nudft_matrix
¶
build_nudft_matrix(coords_in: ndarray, coords_out: ndarray, sign: int = -1) -> jnp.ndarray
Map amplitudes between supplied coordinate sets with a Fourier kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords_in
|
ndarray
|
Source coordinates. Shape (N_axes, N_in). e.g., Sky positions (l, m, n) for a forward transform. |
required |
coords_out
|
ndarray
|
Target coordinates. Shape (N_axes, N_out). e.g., Baselines (u, v, w) for a forward transform. |
required |
sign
|
int
|
Fourier exponent sign: -1 gives |
-1
|
Returns:
| Name | Type | Description |
|---|---|---|
nudft_matrix |
ndarray
|
A Complex128 matrix of shape (N_out, N_in). |
Notes
For input coordinates x_i and output coordinates y_j, return
Multiplication by K maps input amplitudes to the output samples.
The coordinate pairs determine the spaces being connected; sign
selects the Fourier phase convention. Reversing the sign alone does not
construct a matrix inverse for arbitrary non-uniform sampling. The
physical operator builders supply their own integration weights.