Noise

Noise models and likelihood functions for astronomical images.

class socca.noise.Normal(**kwargs)[source]

Bases: object

Multi-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)

getsigma()[source]

Estimate or build the noise standard deviation map.

Returns:

The per-pixel standard deviation map as a JAX array (same shape as self.data).

Return type:

Array

class socca.noise.NormalCorrelated(cov=None, icov=None, cube=None, **kwargs)[source]

Bases: object

Noise 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.

__init__(cov=None, icov=None, cube=None, **kwargs)[source]

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', **kwargs)[source]

Bases: object

Noise 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.

__init__(cov=None, icov=None, cube=None, ftype='real', **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)

  • **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.

class socca.noise.NormalRI(**kwargs)[source]

Bases: object

Noise 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.

getsigma()[source]

Estimate or build the noise standard deviation.

Returns:

The noise standard deviation.

Return type:

float