autolens.Interferometer#

class Interferometer[source]#

Bases: AbstractDataset

An interferometer dataset, containing the visibilities data, noise-map, real-space msk, Fourier transformer and associated quantities for calculations like the grid.

This object is the input to the FitInterferometer object, which fits the dataset with model visibilities and quantifies the goodness-of-fit via a residual map, likelihood, chi-squared and other quantities.

The following quantities of the interferometer data are available and used for the following tasks:

  • data: The visibilities data, which shows the signal that is analysed and fitted with model visibilities.

  • noise_map: The RMS standard deviation error in every visibility, which is used to compute the chi-squared

value and likelihood of a fit.

  • uv_wavelengths: The baselines of the interferometer which are used to Fourier transform a real space

image to the uv-plane.

real_space_mask: Defines in real space where the signal is present. This mask is used to transform images to Fourier space via the Fourier transform. The grids contained in the settings are aligned with this mask.

The dataset also has a number of (y,x) grids of coordinates associated with it, which map to the centres of its image pixels. They are used for performing calculations which map directly to the data and have over sampling calculations built in which approximate the 2D line integral of these calculations within a pixel. This is explained in more detail in the GridsDataset class.

Parameters:
  • data (Visibilities) – The array of the visibilities data containing the signal that is fitted.

  • noise_map (VisibilitiesNoiseMap) – An array describing the RMS standard deviation error in each visibility used for computing quantities like the chi-squared in a fit.

  • uv_wavelengths (ndarray) – The baselines of the interferometer which are used to Fourier transform a real space image to the uv-plane.

  • real_space_mask (Mask2D) – Defines in real space where the signal is present. This mask is used to transform images to Fourier space via the Fourier transform. The grids contained in the settings are aligned with this mask.

  • noise_covariance_matrix – A noise-map covariance matrix representing the covariance between noise in every data value, which can be used via a bespoke fit to account for correlated noise in the data.

  • transformer_class – The class of the Fourier Transform which maps images from real space to Fourier space visibilities and the uv-plane.

  • sparse_operator (Optional[InterferometerSparseOperator]) – A precomputed InterferometerSparseOperator containing the NUFFT precision matrix for efficient pixelized source reconstruction. This is computed via apply_sparse_operator() and can be passed here directly to avoid recomputing it (e.g. when loading a cached result from disk).

  • raise_error_dft_visibilities_limit (bool) – If True, an exception is raised if the dataset has more than 10,000 visibilities and transformer_class=TransformerDFT. The DFT is too slow for large datasets and TransformerNUFFT should be used instead. Set to False to suppress this check.

  • sparse_terms (Optional[SparseTerms]) – The SparseTerms record the sparse_operator was accumulated from, if any (set by from_stream, from_sparse_terms and apply_sparse_operator_from_chunks). It carries the naturally weighted dirty image and beam and the provenance of the accumulation.

  • datasets (Array-free)

  • -------------------

  • data

  • transformer_class=None (noise_map and uv_wavelengths may all be None with)

  • given (when a sparse_operator carrying its data_term and noise_normalization is)

  • build (this is the dataset from_stream / from_sparse_terms)

  • sparse (on which a)

  • Its ((w-tilde) pixelized inversion and its log_evidence need no visibility arrays.)

  • None (transformer is)

  • an (and every quantity that needs the visibilities raises)

  • input. (exc.DatasetException naming the missing)

__init__(data, noise_map, uv_wavelengths, real_space_mask, transformer_class=<class 'autoarray.operators.transformer.TransformerNUFFT'>, sparse_operator=None, raise_error_dft_visibilities_limit=True, sparse_terms=None)[source]#

An interferometer dataset, containing the visibilities data, noise-map, real-space msk, Fourier transformer and associated quantities for calculations like the grid.

This object is the input to the FitInterferometer object, which fits the dataset with model visibilities and quantifies the goodness-of-fit via a residual map, likelihood, chi-squared and other quantities.

The following quantities of the interferometer data are available and used for the following tasks:

  • data: The visibilities data, which shows the signal that is analysed and fitted with model visibilities.

  • noise_map: The RMS standard deviation error in every visibility, which is used to compute the chi-squared

value and likelihood of a fit.

  • uv_wavelengths: The baselines of the interferometer which are used to Fourier transform a real space

image to the uv-plane.

real_space_mask: Defines in real space where the signal is present. This mask is used to transform images to Fourier space via the Fourier transform. The grids contained in the settings are aligned with this mask.

The dataset also has a number of (y,x) grids of coordinates associated with it, which map to the centres of its image pixels. They are used for performing calculations which map directly to the data and have over sampling calculations built in which approximate the 2D line integral of these calculations within a pixel. This is explained in more detail in the GridsDataset class.

Parameters:
  • data (Visibilities) – The array of the visibilities data containing the signal that is fitted.

  • noise_map (VisibilitiesNoiseMap) – An array describing the RMS standard deviation error in each visibility used for computing quantities like the chi-squared in a fit.

  • uv_wavelengths (ndarray) – The baselines of the interferometer which are used to Fourier transform a real space image to the uv-plane.

  • real_space_mask (Mask2D) – Defines in real space where the signal is present. This mask is used to transform images to Fourier space via the Fourier transform. The grids contained in the settings are aligned with this mask.

  • noise_covariance_matrix – A noise-map covariance matrix representing the covariance between noise in every data value, which can be used via a bespoke fit to account for correlated noise in the data.

  • transformer_class – The class of the Fourier Transform which maps images from real space to Fourier space visibilities and the uv-plane.

  • sparse_operator (Optional[InterferometerSparseOperator]) – A precomputed InterferometerSparseOperator containing the NUFFT precision matrix for efficient pixelized source reconstruction. This is computed via apply_sparse_operator() and can be passed here directly to avoid recomputing it (e.g. when loading a cached result from disk).

  • raise_error_dft_visibilities_limit (bool) – If True, an exception is raised if the dataset has more than 10,000 visibilities and transformer_class=TransformerDFT. The DFT is too slow for large datasets and TransformerNUFFT should be used instead. Set to False to suppress this check.

  • sparse_terms (Optional[SparseTerms]) – The SparseTerms record the sparse_operator was accumulated from, if any (set by from_stream, from_sparse_terms and apply_sparse_operator_from_chunks). It carries the naturally weighted dirty image and beam and the provenance of the accumulation.

  • datasets (Array-free)

  • -------------------

  • data

  • transformer_class=None (noise_map and uv_wavelengths may all be None with)

  • given (when a sparse_operator carrying its data_term and noise_normalization is)

  • build (this is the dataset from_stream / from_sparse_terms)

  • sparse (on which a)

  • Its ((w-tilde) pixelized inversion and its log_evidence need no visibility arrays.)

  • None (transformer is)

  • an (and every quantity that needs the visibilities raises)

  • input. (exc.DatasetException naming the missing)

Methods

__init__(data, noise_map, uv_wavelengths, ...)

An interferometer dataset, containing the visibilities data, noise-map, real-space msk, Fourier transformer and associated quantities for calculations like the grid.

apply_over_sampling()

Apply new over-sampling sizes to the dataset grids.

apply_sparse_operator([...])

Precompute the NUFFT precision operator for efficient pixelized source reconstruction.

apply_sparse_operator_from_chunks(chunks, *)

Build the sparse operator by accumulating the visibilities one chunk at a time, rather than from this dataset's resident arrays in one shot.

from_fits(data_path, noise_map_path, ...[, ...])

Load an interferometer dataset from multiple .fits files.

from_sparse_terms(terms, real_space_mask, *)

Build an array-free Interferometer from an accumulated SparseTerms record.

from_stream(chunks, real_space_mask, *[, ...])

Build an array-free Interferometer by accumulating a stream of visibility chunks, never holding the full visibility arrays.

psf_precision_operator_from([chunk_k, ...])

Compute the NUFFT precision matrix for this interferometer dataset.

trimmed_after_convolution_from(kernel_shape)

Return a copy of the dataset with all arrays trimmed to remove the border pixels affected by PSF convolution edge effects.

Attributes

amplitudes

The amplitudes of the complex visibilities, defined as the absolute value of each visibility: amplitude = sqrt(real^2 + imag^2).

dirty_beam

The naturally weighted, normalised dirty beam (synthesised beam) at the image pixels, Re(F^H w) / sum(w) with w = 1 / sigma_r^2: the response of dirty_image_natural to a unit point source at the phase centre (peak 1 at the phase-centre pixel).

dirty_image

The dirty image, computed as the inverse Fourier transform of the observed visibilities.

dirty_image_natural

The naturally weighted, normalised dirty image Re(F^H (w d)) / sum(w), with w = 1 / sigma^2 per visibility component.

dirty_noise_map

The dirty noise map, computed as the inverse Fourier transform of the noise map visibilities.

dirty_signal_to_noise_map

The dirty signal-to-noise map, computed as the inverse Fourier transform of the complex signal-to-noise visibility map.

grid

The primary coordinate grid of the dataset, equivalent to grids.lp.

is_array_free

True for a dataset built by from_stream / from_sparse_terms, which carries no visibility arrays (data, noise_map, uv_wavelengths) and no transformer.

mask

The real-space mask of the interferometer dataset.

noise_covariance_matrix_inv

Returns the inverse of the noise covariance matrix, which is used when computing a chi-squared which accounts for covariance via a fit.

phases

The phases of the complex visibilities in radians, defined as arctan(imag / real) for each visibility.

pixel_scales

The (y, x) arcsecond-to-pixel conversion factor of the dataset, as a (float, float) tuple.

psf

Returns None for interferometer datasets.

shape_native

The 2D shape of the dataset image in its native (unmasked) dimensions, e.g. (rows, columns).

shape_slim

The 1D size of the dataset data array after masking, i.e. the number of unmasked pixels.

signal_to_noise_map

The complex signal-to-noise map of the visibilities.

signal_to_noise_max

The maximum signal-to-noise value across all unmasked pixels in the dataset.

uv_distances

The radial distance of each visibility baseline from the origin of the UV-plane, in units of wavelengths.

__init__(data, noise_map, uv_wavelengths, real_space_mask, transformer_class=<class 'autoarray.operators.transformer.TransformerNUFFT'>, sparse_operator=None, raise_error_dft_visibilities_limit=True, sparse_terms=None)[source]#

An interferometer dataset, containing the visibilities data, noise-map, real-space msk, Fourier transformer and associated quantities for calculations like the grid.

This object is the input to the FitInterferometer object, which fits the dataset with model visibilities and quantifies the goodness-of-fit via a residual map, likelihood, chi-squared and other quantities.

The following quantities of the interferometer data are available and used for the following tasks:

  • data: The visibilities data, which shows the signal that is analysed and fitted with model visibilities.

  • noise_map: The RMS standard deviation error in every visibility, which is used to compute the chi-squared

value and likelihood of a fit.

  • uv_wavelengths: The baselines of the interferometer which are used to Fourier transform a real space

image to the uv-plane.

real_space_mask: Defines in real space where the signal is present. This mask is used to transform images to Fourier space via the Fourier transform. The grids contained in the settings are aligned with this mask.

The dataset also has a number of (y,x) grids of coordinates associated with it, which map to the centres of its image pixels. They are used for performing calculations which map directly to the data and have over sampling calculations built in which approximate the 2D line integral of these calculations within a pixel. This is explained in more detail in the GridsDataset class.

Parameters:
  • data (Visibilities) – The array of the visibilities data containing the signal that is fitted.

  • noise_map (VisibilitiesNoiseMap) – An array describing the RMS standard deviation error in each visibility used for computing quantities like the chi-squared in a fit.

  • uv_wavelengths (ndarray) – The baselines of the interferometer which are used to Fourier transform a real space image to the uv-plane.

  • real_space_mask (Mask2D) – Defines in real space where the signal is present. This mask is used to transform images to Fourier space via the Fourier transform. The grids contained in the settings are aligned with this mask.

  • noise_covariance_matrix – A noise-map covariance matrix representing the covariance between noise in every data value, which can be used via a bespoke fit to account for correlated noise in the data.

  • transformer_class – The class of the Fourier Transform which maps images from real space to Fourier space visibilities and the uv-plane.

  • sparse_operator (Optional[InterferometerSparseOperator]) – A precomputed InterferometerSparseOperator containing the NUFFT precision matrix for efficient pixelized source reconstruction. This is computed via apply_sparse_operator() and can be passed here directly to avoid recomputing it (e.g. when loading a cached result from disk).

  • raise_error_dft_visibilities_limit (bool) – If True, an exception is raised if the dataset has more than 10,000 visibilities and transformer_class=TransformerDFT. The DFT is too slow for large datasets and TransformerNUFFT should be used instead. Set to False to suppress this check.

  • sparse_terms (Optional[SparseTerms]) – The SparseTerms record the sparse_operator was accumulated from, if any (set by from_stream, from_sparse_terms and apply_sparse_operator_from_chunks). It carries the naturally weighted dirty image and beam and the provenance of the accumulation.

  • datasets (Array-free)

  • -------------------

  • data

  • transformer_class=None (noise_map and uv_wavelengths may all be None with)

  • given (when a sparse_operator carrying its data_term and noise_normalization is)

  • build (this is the dataset from_stream / from_sparse_terms)

  • sparse (on which a)

  • Its ((w-tilde) pixelized inversion and its log_evidence need no visibility arrays.)

  • None (transformer is)

  • an (and every quantity that needs the visibilities raises)

  • input. (exc.DatasetException naming the missing)

classmethod from_fits(data_path, noise_map_path, uv_wavelengths_path, real_space_mask, visibilities_hdu=0, noise_map_hdu=0, uv_wavelengths_hdu=0, transformer_class=<class 'autoarray.operators.transformer.TransformerNUFFT'>, raise_error_dft_visibilities_limit=True)[source]#

Load an interferometer dataset from multiple .fits files.

The visibilities (complex-valued Fourier-space data), noise map and uv_wavelengths (baseline coordinates) are each loaded from separate .fits files. A real-space mask defining the sky region used for Fourier transforms must be supplied separately.

The visibilities are assumed to be stored as a 2D array of shape (total_visibilities, 2) where column 0 is the real component and column 1 is the imaginary component. The noise map has the same shape. The uv_wavelengths are a 2D array of shape (total_visibilities, 2) with columns corresponding to the (u, v) baseline coordinates in units of wavelengths.

Parameters:
  • data_path – The path to the .fits file containing the visibility data (e.g. ‘/path/to/visibilities.fits’).

  • noise_map_path – The path to the .fits file containing the visibility noise map (e.g. ‘/path/to/noise_map.fits’).

  • uv_wavelengths_path – The path to the .fits file containing the (u, v) baseline coordinates in units of wavelengths (e.g. ‘/path/to/uv_wavelengths.fits’).

  • real_space_mask – A Mask2D defining the real-space region of the sky that contains signal. This mask determines the pixel grid used by the Fourier transformer and the coordinate grids associated with the dataset.

  • visibilities_hdu – The HDU index in the visibilities .fits file from which data is loaded.

  • noise_map_hdu – The HDU index in the noise map .fits file from which data is loaded.

  • uv_wavelengths_hdu – The HDU index in the uv_wavelengths .fits file from which data is loaded.

  • transformer_class – The class of the Fourier Transform which maps images from real space to Fourier space visibilities. Defaults to TransformerNUFFT for efficiency with large datasets.

  • raise_error_dft_visibilities_limit (bool) – If True (default), raise a DatasetException when transformer_class is TransformerDFT and the dataset has more than 10,000 visibilities. Set to False to opt into the slow DFT path at ALMA-scale (e.g. when profiling the JAX-traceable DFT path before a JIT-friendly NUFFT is available).

Returns:

The interferometer dataset loaded from the .fits files.

Return type:

Interferometer

classmethod from_sparse_terms(terms, real_space_mask, *, batch_size=128)[source]#

Build an array-free Interferometer from an accumulated SparseTerms record.

The returned dataset carries no visibility arrays: data, noise_map, uv_wavelengths and transformer are all None. It carries the InterferometerSparseOperator built from terms (with its cached data_term and noise_normalization) and terms itself (as sparse_terms), which is everything a sparse (w-tilde) pixelized inversion and its log_evidence read, so a fit on it equals one on the in-memory apply_sparse_operator() dataset. Quantities that need the visibilities (amplitudes, dirty_image, residual maps of a fit, …) raise an exc.DatasetException; the naturally weighted dirty_image_natural and dirty_beam are available from the terms.

Parameters:
  • terms (SparseTerms) – The accumulated sums of every visibility the dataset represents (e.g. from inversion_interferometer_util.sparse_terms_from_chunks).

  • real_space_mask (Mask2D) – The real-space Mask2D the terms were accumulated on.

  • batch_size (int) – The number of source-pixel columns processed per batch by the sparse operator.

classmethod from_stream(chunks, real_space_mask, *, transformer_class=<class 'autoarray.operators.transformer.TransformerNUFFT'>, method='nufft', eps=None, chunk_size=None, chunk_k=2048, use_jax=False, show_progress=False, batch_size=128, phase_centre=None, pool_noise_map=False, oversample=None, oversample_pad=0.25)[source]#

Build an array-free Interferometer by accumulating a stream of visibility chunks, never holding the full visibility arrays.

chunks is any iterable (a list, or a generator reading from disk) of (uv_wavelengths, data, noise_map) triples, with the contract of apply_sparse_operator_from_chunks. They are reduced one at a time by inversion_interferometer_util.sparse_terms_from_chunks into a SparseTerms record, which from_sparse_terms turns into the dataset; peak memory is set by the chunk size, not the dataset size.

The sparse terms assume every visibility has equal real and imaginary noise sigma: the precision operator and dirty beam are built from the real-part sigma alone. By default a chunk with unequal sigmas raises. For thermal noise a difference usually comes from the noise estimator (1-2 % when estimated by differencing adjacent visibilities); pass pool_noise_map=True to pool each chunk’s sigmas in quadrature, sigma^2 = (sigma_real^2 + sigma_imag^2) / 2 (which preserves the total variance), or pool them yourself before handing the chunks over with inversion_interferometer_util.noise_map_pooled_from. Pooling is approximate when the sigmas genuinely differ (the sparse curvature then drops the cos(a + b) term of the unequal weights; see sparse_terms_from_chunks), and the pooled noise_normalization differs from the unpooled one, so do not compare log-evidences of a pooled and an unpooled fit.

Parameters:
  • chunks – The (uv_wavelengths, data, noise_map) chunks.

  • real_space_mask (Mask2D) – The real-space Mask2D the terms are accumulated on.

  • transformer_class – Passed to sparse_terms_from_chunks.

  • method (str) – Passed to sparse_terms_from_chunks.

  • eps (Optional[float]) – Passed to sparse_terms_from_chunks.

  • chunk_size (Optional[int]) – Passed to sparse_terms_from_chunks.

  • chunk_k (int) – Passed to sparse_terms_from_chunks.

  • use_jax (bool) – Passed to sparse_terms_from_chunks.

  • show_progress (bool) – Passed to sparse_terms_from_chunks.

  • batch_size (int) – The number of source-pixel columns processed per batch by the sparse operator.

  • phase_centre (Optional[Tuple[float, float]]) – The (y, x) phase-centre shift in arcseconds applied to every chunk’s visibilities, d’ = d * exp(+2 pi i (u * x0 + v * y0)) (radians), so a source at (y0, x0) lands at the image origin; recorded as sparse_terms.phase_centre. None applies no shift (recorded as (0.0, 0.0)). See sparse_terms_from_chunks.

  • pool_noise_map (bool) – If True, pool every chunk’s real and imaginary noise sigma in quadrature before forming the terms instead of raising on unequal sigmas, logging the median and maximum difference once (a warning when the median exceeds 25 %). See sparse_terms_from_chunks.

  • oversample (Optional[int]) – If oversample=q (a positive even integer) is set, also accumulate the fine precision-operator and dirty-image grids q times finer than the image pixel, for components analytic in the uv-plane (points, small Gaussians); they are carried on sparse_terms (precision_operator_fine, dirty_image_fine) and need the NUFFT transformer. Memory grows as q^2 (~5-6 GB peak at 400 pixels, q = 8); see sparse_terms_from_chunks, “Fine grids”.

  • oversample_pad (float) – If oversample=q (a positive even integer) is set, also accumulate the fine precision-operator and dirty-image grids q times finer than the image pixel, for components analytic in the uv-plane (points, small Gaussians); they are carried on sparse_terms (precision_operator_fine, dirty_image_fine) and need the NUFFT transformer. Memory grows as q^2 (~5-6 GB peak at 400 pixels, q = 8); see sparse_terms_from_chunks, “Fine grids”.

Raises:

exc.DatasetException – If any chunk has unequal real and imaginary noise sigma and pool_noise_map is False.

property is_array_free: bool#

True for a dataset built by from_stream / from_sparse_terms, which carries no visibility arrays (data, noise_map, uv_wavelengths) and no transformer.

apply_sparse_operator(nufft_precision_operator=None, batch_size=128, method='nufft', eps=None, nufft_chunk_size=None, chunk_k=2048, show_progress=False, show_memory=False, use_jax=False, pool_noise_map=False)[source]#

Precompute the NUFFT precision operator for efficient pixelized source reconstruction.

The sparse linear algebra formalism precomputes the Fourier Transform response matrix for all visibility baselines, enabling fast repeated evaluation during model fitting. This avoids recomputing the full NUFFT on every likelihood call.

The resulting InterferometerSparseOperator is stored on the returned Interferometer dataset and is used automatically by FitInterferometer when performing pixelized reconstructions via the inversion module.

The backend the operator is applied with follows the inversion’s xp (NumPy/scipy for xp=np, JAX for xp=jnp); use_jax below only selects which brute-force builder computes the preload, and never puts JAX on a NumPy fit’s application path.

The default builder (method=”nufft”) computes the precision operator as a type-1 NUFFT, so it costs O(N_vis * nspread^2 + M log M) for M = 4 * Ny * Nx — seconds even at a million visibilities. The brute-force builders (method=”numpy” / “jax”) are O(N_vis * N_pix) and can take minutes to hours; they are kept as the reference the NUFFT builder is pinned against. Either way the result can be cached to disk and reloaded via nufft_precision_operator=.

Parameters:
  • nufft_precision_operator – An already computed NUFFT precision matrix for this dataset (e.g. loaded from disk via np.load) to avoid an expensive recomputation. If None it is computed from scratch by calling psf_precision_operator_from().

  • batch_size (int) – The number of real-space pixels processed per batch when building the sparse operator. Reducing this lowers peak memory usage at the cost of speed.

  • method (str) – Which builder computes the precision operator: “nufft” (default, the type-1 NUFFT), “numpy” or “jax” (the brute-force reference builders).

  • eps (Optional[float]) – The requested NUFFT precision of the “nufft” builder. None takes the transformer’s own eps when it is a TransformerNUFFT, else 1e-12.

  • nufft_chunk_size (Optional[int]) – The visibility chunk size of the “nufft” builder, a memory ceiling rather than an optimisation. None takes the transformer’s own chunk_size when it is a TransformerNUFFT, else no chunking.

  • chunk_k (int) – The number of visibilities processed per chunk by the brute-force builders when computing the NUFFT precision matrix inside psf_precision_operator_from(). Reducing this lowers peak memory usage.

  • show_progress (bool) – If True, a progress bar is displayed while computing the NUFFT precision matrix.

  • show_memory (bool) – If True, memory usage statistics are printed while computing the NUFFT precision matrix.

  • use_jax (bool) –

    Only honoured when a brute-force builder is selected: method=”numpy” with use_jax=True runs the JAX brute force (equivalent to method=”jax”). Under the default method=”nufft” it is ignored, because the NUFFT already runs on JAX – so an existing use_jax=True call keeps the fast path rather than being demoted to the O(N_vis * N_pix) brute force.

    PYAUTO_DISABLE_JAX=1 overrides this to False. That variable is a harness-level switch, not a preference: it is the documented way to force the NumPy path (the workspace start_here guides name it beside use_jax=False), and the smoke profiles set it so a fast run does not pay a JIT compile. An explicit use_jax=True in a script – which is the right thing for a script demonstrating the production path to say – must therefore not defeat it, or the harness pays 2.3-3.2 s of compile for a backend it asked to disable. (The same switch demotes the “nufft” builder to the NumPy brute force inside nufft_precision_operator_from.)

  • pool_noise_map (bool) – If True, pool the real and imaginary noise sigma of every visibility in quadrature, sigma^2 = (sigma_real^2 + sigma_imag^2) / 2, before building the operator, instead of raising on unequal sigmas (see “Precondition” below). The returned dataset carries the pooled noise_map.

  • Precondition

  • ------------

  • sigma (Every visibility must have equal real and imaginary noise)

  • operator ((noise_map.real == noise_map.imag). The sparse operator's precision)

  • (see (W~ = Re(F^H W F) is built from the real-part sigma alone)

  • psf_precision_operator_from

  • to (which passes noise_map_real)

  • nufft_precision_operator_from)

  • that (a reduction that is exact only under)

  • with (equality. With unequal sigmas the sparse curvature matrix silently disagrees)

  • path (the dense InversionInterferometerMapping)

  • a (so by default this method raises)

  • operator. (DatasetException rather than returning a wrong)

  • same (For thermal noise the real and imaginary parts of one visibility have the)

  • variance

  • when (so a measured difference usually comes from the noise estimator (1-2 %)

  • pool_noise_map=True (the noise is estimated by differencing adjacent visibilities).)

  • median (pools the two in quadrature (which preserves the total variance) and logs the)

  • once (and maximum difference)

  • it (above)

  • the (so do not compare)

  • noise_map=inversion_interferometer_util.noise_map_pooled_from(noise_map). (dataset with)

  • differ (Pooling is approximate when the sigmas genuinely)

  • w_r

  • b) (w_i the exact curvature is sum wbar cos(a - b) + dw cos(a +)

  • 2 ((wbar = (w_r + w_i) /)

  • the

  • part (cos(a - b))

  • (no (so the dense InversionInterferometerMapping path)

  • pooled (data_term / noise_normalization describe the same noise model. The)

  • noise_map

  • sparse (so the dense residual and chi-squared maps and the cached)

  • pooled

  • one (noise_normalization differs from the unpooled)

  • the

  • data. (log-evidences of a pooled and an unpooled fit of the same)

Returns:

A new Interferometer dataset with the precomputed InterferometerSparseOperator attached, enabling efficient pixelized source reconstruction via the sparse linear algebra formalism. With pool_noise_map=True its noise_map is the pooled one.

Return type:

Interferometer

Raises:

exc.DatasetException – If any visibility has unequal real and imaginary noise sigma and pool_noise_map is False.

apply_sparse_operator_from_chunks(chunks, *, batch_size=128, **accumulator_kwargs)[source]#

Build the sparse operator by accumulating the visibilities one chunk at a time, rather than from this dataset’s resident arrays in one shot.

This is the chunked counterpart of apply_sparse_operator: every quantity the sparse likelihood needs from the visibilities – the NUFFT precision operator W~, the noise-weighted dirty image, sum(d^2 / sigma^2) and sum(log(2 pi sigma^2)) – is a sum over visibilities, so it is accumulated per chunk by inversion_interferometer_util.sparse_terms_from_chunks into a SparseTerms record and turned into an InterferometerSparseOperator by InterferometerSparseOperator.from_sparse_terms. The result equals apply_sparse_operator() to summation order (verified at rtol=1e-12 by the test suite), and the operator carries both scalars, so a fit on it never reduces over the visibility arrays in its likelihood.

psf_precision_operator_from(chunk_k=2048, show_progress=False, show_memory=False, use_jax=False, method='nufft', eps=None, nufft_chunk_size=None)[source]#

Compute the NUFFT precision matrix for this interferometer dataset.

The precision matrix encodes the response of every real-space pixel to every visibility baseline, weighted by the noise map. It is the core precomputed quantity required for efficient pixelized source reconstruction via the sparse linear algebra formalism.

The default builder (method=”nufft”) computes this as a type-1 (adjoint) NUFFT, which is O(N_vis * nspread^2 + M log M) for M = 4 * Ny * Nx — seconds even at a million visibilities. The brute-force builders (method=”numpy” / “jax”) are O(N_vis * N_pix) and can take minutes to hours on a CPU for a high-resolution mask; they are kept as the reference the NUFFT builder is pinned against. The result can still be saved to disk and reloaded rather than recomputed on each run — use apply_sparse_operator(nufft_precision_operator=…) to attach a cached result.

Parameters:
  • chunk_k (int) – The number of visibilities processed per chunk by the brute-force builders. Reducing this lowers peak memory usage during computation at the cost of speed.

  • show_progress (bool) – If True, a progress bar is shown during computation by the NumPy brute force.

  • show_memory (bool) – If True, memory usage statistics are printed during computation.

  • use_jax (bool) – Only honoured when a brute-force builder is selected: method=”numpy” with use_jax=True runs the JAX brute force (equivalent to method=”jax”). It is ignored under the default method=”nufft”, which already runs on JAX.

  • method (str) – Which builder computes the operator: “nufft” (default), “numpy” or “jax”.

  • eps (Optional[float]) – The requested NUFFT precision of the “nufft” builder. None takes the transformer’s own eps when it is a TransformerNUFFT, else 1e-12.

  • nufft_chunk_size (Optional[int]) – The visibility chunk size of the “nufft” builder, a memory ceiling rather than an optimisation. None takes the transformer’s own chunk_size when it is a TransformerNUFFT, else no chunking.

Returns:

The NUFFT precision matrix of shape (total_pixels, total_pixels) where total_pixels is the number of unmasked real-space pixels.

Return type:

np.ndarray

property mask#

The real-space mask of the interferometer dataset.

For an interferometer, this is the real_space_mask which defines the region of sky that contains signal. It is used as the spatial domain for the Fourier transform, determining the pixel grid size and coordinate grids.

property amplitudes#

The amplitudes of the complex visibilities, defined as the absolute value of each visibility: amplitude = sqrt(real^2 + imag^2).

property phases#

The phases of the complex visibilities in radians, defined as arctan(imag / real) for each visibility.

property uv_distances#

The radial distance of each visibility baseline from the origin of the UV-plane, in units of wavelengths. Computed as sqrt(u^2 + v^2) for each (u, v) baseline pair.

property dirty_image#

The dirty image, computed as the inverse Fourier transform of the observed visibilities.

This is the raw image obtained by back-projecting the visibilities without any deconvolution. It provides a quick visual representation of the data but is convolved with the synthesized beam (the Fourier transform of the UV-plane sampling function).

property dirty_image_natural#

The naturally weighted, normalised dirty image Re(F^H (w d)) / sum(w), with w = 1 / sigma^2 per visibility component.

Unlike dirty_image (the unweighted adjoint of the data), this is the image whose peak for a unit point source at the phase centre is 1 – the standard dirty image of radio astronomy. It is available on both dataset types: an array-free dataset reads it from its sparse_terms (dirty_image_native / sum_weights), an in-memory one computes it from its visibilities and transformer.

property dirty_beam#

The naturally weighted, normalised dirty beam (synthesised beam) at the image pixels, Re(F^H w) / sum(w) with w = 1 / sigma_r^2: the response of dirty_image_natural to a unit point source at the phase centre (peak 1 at the phase-centre pixel).

An array-free dataset reads it from its sparse_terms (dirty_beam_native / sum_weights); an in-memory one computes it from its noise-map and transformer.

property dirty_noise_map#

The dirty noise map, computed as the inverse Fourier transform of the noise map visibilities.

Provides a real-space representation of the noise levels in the dirty image.

property dirty_signal_to_noise_map#

The dirty signal-to-noise map, computed as the inverse Fourier transform of the complex signal-to-noise visibility map.

property signal_to_noise_map#

The complex signal-to-noise map of the visibilities.

Computed separately for the real and imaginary components as data / noise_map. Values below zero are clamped to zero, as negative signal-to-noise is not physically meaningful.

Unlike the base class implementation (which operates on real-valued data), this override handles the complex nature of interferometric visibilities by treating the real and imaginary parts independently.

property psf#

Returns None for interferometer datasets.

Interferometers do not have a Point Spread Function in the same sense as imaging datasets. The equivalent quantity is the synthesized beam, which is determined by the UV-plane coverage and is not stored explicitly. This property exists to satisfy the AbstractDataset interface.