Noise¶
Noise models and likelihood functions for astronomical images.
- class socca.noise.Normal(**kwargs)[source]¶
Bases:
objectMulti-variate normal noise model with no correlation between pixels.
- Variables:
options (dict) – Dictionary of accepted noise model identifiers and their aliases.
select (str or None) – Selected noise model identifier from the provided keyword arguments.
kwargs (dict) – Keyword arguments provided for specifying the noise model.
data (jax.numpy.ndarray) – Image data array. This is set when the model is called.
mask (jax.numpy.ndarray) – Image mask array. This is set when the model is called.
- __init__(**kwargs)[source]¶
Initialize normal noise model.
- Parameters:
**kwargs (dict) –
Keyword arguments for specifying the noise model. Accepted keywords (with aliases):
- sigmafloat or str, optional
Standard deviation of the noise. Default is None, in which case the noise level is estimated using the median absolute deviation. Accepted aliases:
sig,std,rms,stddev.
- varfloat or str, optional
Variance of the noise. Accepted aliases:
var,variance.
- whtfloat or str, optional
Weight (inverse variance) of the noise. Accepted aliases:
wht,wgt,weight,weights,invvar.
- idxint, optional
HDU index to use when loading noise maps from FITS files. Default is 0.
these (If a string is provided for any of)
path (it is treated as a)
map. (to a FITS file containing the corresponding)
Bases:
objectNoise model with correlated multi-variate normal distribution.
- Variables:
cov (jax.numpy.ndarray) – Covariance matrix of the noise.
icov (jax.numpy.ndarray) – Inverse of the covariance matrix.
norm (float) – Normalization factor for the log-likelihood.
data (jax.numpy.ndarray) – Image data array.
mask (jax.numpy.ndarray) – Boolean mask array.
Initialize correlated normal noise model.
- Parameters:
cov (array_like, optional) – Covariance matrix. If not provided, computed from cube.
icov (array_like, optional) – Inverse covariance matrix. If provided, used directly.
cube (array_like, optional) – 3D array of noise realizations. First dimension is the number of realizations. Used to compute covariance if cov is None.
**kwargs (dict) –
Additional keyword arguments:
- smoothint, optional
Number of smoothing iterations for covariance matrix. Default is 3.
- kernelarray_like, optional
Custom smoothing kernel. If None, uses a 5-point stencil.
- class socca.noise.NormalFourier(cov=None, icov=None, cube=None, ftype='real', covmodel='diagonal', **kwargs)[source]¶
Bases:
objectNoise model with independent noise in Fourier space.
The noise covariance is defined in Fourier space.
- Variables:
cmask (jax.numpy.ndarray) – Boolean mask indicating which Fourier modes have non-zero noise.
ftype (str) –
Type of Fourier transform to use. Options are:
’real’ or ‘rfft’: real-to-complex FFT (for real input data)
’full’ or ‘fft’: complex-to-complex FFT (for complex input data)
apod (jax.numpy.ndarray) – Apodization map applied to the data before Fourier transforming.
cov (jax.numpy.ndarray) – Noise covariance in Fourier space.
icov (jax.numpy.ndarray) – Inverse noise covariance in Fourier space.
norm (float) – Normalization constant for the log-pdf.
data (jax.numpy.ndarray) – Image data array. This is set when the model is called.
mask (jax.numpy.ndarray) – Image mask array. This is set when the model is called.
covmodel (str) – Covariance treatment: ‘diagonal’ (default) or ‘banded’.
chol_banded (jax.numpy.ndarray) – Banded Cholesky factor of the non-diagonal covariance. Only set when
covmodel='banded'.bandwidth (int) – Bandwidth of
chol_banded. Only set whencovmodel='banded'.norm_full (float) – Normalization constant for the banded log-pdf. Only set when
covmodel='banded'.
- __init__(cov=None, icov=None, cube=None, ftype='real', covmodel='diagonal', **kwargs)[source]¶
Initialize Fourier-space noise model.
- Parameters:
cov (array_like, optional) – Noise covariance in Fourier space. If not provided, computed from cube.
icov (array_like, optional) – Inverse noise covariance in Fourier space. If provided, used directly.
cube (array_like, optional) – 3D array of noise realizations. First dimension is the number of realizations. Used to compute covariance if cov is None.
ftype (str, optional, default 'real') –
Type of Fourier transform to use. Options are:
’real’ or ‘rfft’: real-to-complex FFT (for real input data)
’full’ or ‘fft’: complex-to-complex FFT (for complex input data)
covmodel (str, optional, default 'diagonal') –
Covariance treatment in Fourier space:
’diagonal’: treat Fourier modes as independent (current default behavior).
’banded’: account for the mode-coupling induced by apodization via a banded, non-diagonal covariance and a banded Cholesky factorization. Requires
cube. The intrinsic noise power spectrum is estimated from the raw (unapodized) cube, and the known apodization window is applied analytically, rather than reusing the windowed periodogram used bycovmodel='diagonal'– so the two modes generally yield different covariance estimates from the samecube, not just different likelihood treatments of the same estimate. Seeradiusandridgebelow.
**kwargs (dict) –
Additional keyword arguments:
- apodarray_like, optional
Apodization map applied to the data before Fourier transforming. Default is no apodization.
- smoothint, optional
Number of smoothing iterations for covariance matrix. Default is 3.
- kernelarray_like, optional
Custom smoothing kernel. If None, uses a 5-point stencil.
- tolfloat, optional
Only used when the covariance is estimated from
cubeandcovmodel='diagonal'. Fourier modes whose raw (pre-smoothing) power estimate falls belowtoltimes their own local (smoothed) power are excluded from the likelihood (their icov is set to 0), rather than kept with an inflated weight. Comparing against this local reference, rather than a single global scale, means the cutoff doesn’t misfire on a noise spectrum with genuine, smoothly-varying dynamic range. Default is None, in which case it is derived automatically from the spread oflog(raw / smoothed)via a robust (MAD-based) outlier threshold. Not applied whencovmodel='banded'.
- radiusint, optional, default 8
Only used when
covmodel='banded'. Coupling truncation radius, in Fourier-index units, for the banded covariance. Modes further apart thanradiusare treated as exactly uncorrelated. This also bounds the inner sum used to evaluate the coupling kernel itself.
- ridgefloat, optional, default 0.0
Only used when
covmodel='banded'. Diagonal loading added to the banded covariance before factorization, as a fallback if truncation leaves it not strictly positive-definite. If factorization fails withridge=0.0, try increasingradiusorridge.
Warning
covmodel='banded'is substantially more expensive than the default: setup performs a one-time banded Cholesky factorization, and every likelihood evaluation performs a sequential banded triangular solve that, unlike every other noise model in this module, does not fully vectorize/parallelize. Consider this cost for samplers requiring many likelihood evaluations. The banded covariance is also an approximation in a second sense: coupling that wraps around the row-major degrees-of-freedom ordering (modes withinradiusof theky=0/ky=nyedge) is not captured, in addition to theradiustruncation itself.
- class socca.noise.NormalRI(**kwargs)[source]¶
Bases:
objectNoise model for radio-interferometric data.
Computes the Fourier-space likelihood using an image-based approximation by describing the interferometric transfer function and noise covariance via its image-space dirty beam.
- Variables:
options (dict) – Dictionary of accepted noise model identifiers and their aliases.
select (str or None) – Selected noise model identifier from the provided keyword arguments.
kwargs (dict) – Keyword arguments provided for specifying the noise model.
data (jax.numpy.ndarray) – Image data array. This is set automatically from the reference image.
mask (jax.numpy.ndarray) – Boolean mask array. This is set automatically from the reference image.
sigma (float) – Noise standard deviation.
References
Powell, D., et al., MNRAS, 501, 515 (2021) Powell, D., et al., MNRAS, 516, 1808 (2022) Zhang, N., et al., arXiv:2508.08393 (2025)
- __init__(**kwargs)[source]¶
Initialize radio-interferometric noise model.
- Parameters:
**kwargs (dict) –
Keyword arguments for specifying the noise model. Accepted keywords (with aliases):
- sigmafloat, optional
Standard deviation of the noise. Default is None, in which case the noise level is estimated using the median absolute deviation. Accepted aliases:
sig,std,rms,stddev.
- varfloat, optional
Variance of the noise. Accepted aliases:
var,variance.
- whtfloat, optional
Weight (inverse variance) of the noise. Accepted aliases:
wht,wgt,weight,weights,invvar.