Module lib.operators

Helper functions to simplify the call to the measurement and SARA operators (forward and adjoint operators).

lib.operators.HS_adjoint_operator(y, Gw, At, N, M)

Apply adjoint of the wideband measurement operator (w/o data blocking, adjoint of lib.operators.HS_forward_operator()).

Parameters
  • y (cell of complex[:]) – Input visibilities.

  • Gw (cell of sparse complex[:, :]) – Degridding matrix (per channel).

  • At (anonymous function) – Weighted iFFT involved in the adjoint NUFFT.

  • N (int) – Spatial dimension of the wideband image (y axis).

  • M (int) – Spatial dimension of the wideband image (x axis).

Returns

x – Output wideband image.

Return type

double[:, :, :]

lib.operators.HS_adjoint_operator_G(y, G, W, At, N, M, flag_visibility_gridding, Lambda)

Apply adjoint of the wideband measurement operator (with or w/o data dimensionality reduction, adjoint of lib.operators.HS_forward_operator_G()).

Parameters
  • y (cell of cell of complex[:]) – Input visibilities.

  • G (cell of cell of sparse complex[:, :]) – Degridding matrix or holographic matrix if visibility gridding is active (per channel per block).

  • W (cell of cell of int[:]) – Selection vector to extract data blocks from the full Fourier plane.

  • At (anonymous function) – Weighted iFFT involved in the adjoint NUFFT.

  • N (int) – Spatial dimension of the wideband image (y axis).

  • M (int) – Spatial dimension of the wideband image (x axis).

  • flag_visibility_gridding (bool) – Flag indicating whether data dimensionality reduction via visibility gridding is considered.

  • Lambda (cell of cell of double[:]) – Weighting matrix involved in data dimensionality reduction via visibility gridding.

Returns

x – Output wideband image.

Return type

double[:, :, :]

lib.operators.HS_adjoint_operator_precond(y, Gw, At, aW, N, M)

Apply adjoint of the preconditioned wideband measurement operator (w/o data blocking, adjoint of lib.operators.HS_forward_operator_precond()).

Parameters
  • y (cell of complex[:]) – Input visibilities.

  • Gw (cell of sparse complex[:, :]) – Degridding matrix (per channel).

  • At (anonymous function) – Weighted iFFT involved in the adjoint NUFFT.

  • aW (cell of double[:]) – Diagonal preconditioning matrices (encoded as vector, each cell entry associated with a different channel).

  • N (int) – Spatial dimension of the wideband image (y axis).

  • M (int) – Spatial dimension of the wideband image (x axis).

Returns

x – Output wideband image.

Return type

double[:, :, :]

lib.operators.HS_adjoint_operator_precond_G(y, G, W, At, aW, N, M, flag_visibility_gridding, Lambda)

Apply adjoint of the preconditioned wideband measurement operator (with or w/o data dimensionality reduction, adjoint of lib.operators.HS_forward_operator_precond_G()).

Parameters
  • y (cell of cell of complex[:]) – Input visibilities.

  • G (cell of cell of sparse complex[:, :]) – Degridding matrix or holographic matrix if visibility gridding is active (per channel per block).

  • W (cell of cell of int[:]) – Selection vector to extract data blocks from the full Fourier plane.

  • At (anonymous function) – Weighted iFFT involved in the adjoint NUFFT.

  • aW (cell of cell of double) – Diagonal preconditioning matrices (encoded as vector, for each channel and data block within a channel).

  • N (int) – Spatial dimension of the wideband image (y axis).

  • M (int) – Spatial dimension of the wideband image (x axis).

  • flag_visibility_gridding (bool) – Flag indicating whether data dimensionality reduction via visibility gridding is considered.

  • Lambda (cell of cell of double) – Weighting vector involved in data dimensionality reduction via visibility gridding.

Returns

x – Output wideband image.

Return type

double[:, :, :]

lib.operators.HS_adjoint_sparsity(x, Psit, b)

Apply the SARA dictionary to a wideband image (adjoint of lib.operators.HS_forward_sparsity()).

Parameters
  • x (double[:, :, :]) – Wideband image [N(1), N(2), L]

  • Psit (anonymous function) – Function handle representing the serial implementation of the SARA dictionary.

  • b (int) – Number of coefficients obtained after application of the SARA dictionary to a monochromatic image.

Returns

x_wave – Wavelet dictionaries obtained for each channel [b, L].

Return type

double[:, :]

lib.operators.HS_forward_operator(x, Gw, A)

Apply the forward wideband measurement operator (w/o data blocking, adjoint of lib.operators.HS_adjoint_operator()).

Parameters
  • x (double[:, :, :]) – Wideband image.

  • Gw (cell of sparse complex[:, :]) – Degridding matrix (per channel).

  • A (anonymous function) – Weighted FFT involved in the NUFFT.

Returns

y – Visibilities.

Return type

cell of complex[:]

lib.operators.HS_forward_operator_G(x, G, W, A, flag_visibility_gridding, Lambda)

Apply the forward wideband measurement operator (with or w/o data dimensionality reduction, adjoint of lib.operators.HS_adjoint_operator_G()).

Parameters
  • x (double[:, :, :]) – Wideband image.

  • G (cell of cell of sparse complex[:, :]) – Degridding matrix or holographic matrix if visibility gridding is active (per channel per block).

  • W (cell of cell of int[:]) – Selection vector to map data blocks to the full Fourier plane.

  • A (anonymous function) – Weighted FFT involved in the NUFFT.

  • flag_visibility_gridding (bool) – Flag indicating whether data dimensionality reduction via visibility gridding is considered.

  • Lambda (cell of cell of double[:]) – Weighting matrix involved in data dimensionality reduction via visibility gridding.

Returns

y – Output visibilities.

Return type

cell of cell of complex[:]

lib.operators.HS_forward_operator_precond(x, Gw, A, aW)

Apply the forward preconditioned wideband measurement operator (w/o data blocking, adjoint of lib.operators.HS_adjoint_operator_precond()).

Parameters
  • x (double[:, :, :]) – Wideband image.

  • Gw (cell of sparse complex[:, :]) – Degridding matrix (per channel).

  • A (anonymous function) – Weighted FFT involved in the NUFFT.

  • aW (cell of double[:]) – Diagonal preconditioning matrices (encoded as vector, each cell entry associated with a different channel).

Returns

y – Output visibilities.

Return type

cell of complex[:]

lib.operators.HS_forward_operator_precond_G(x, G, W, A, aW, flag_visibility_gridding, Lambda)

Apply the forward preconditioned wideband measurement operator (with or w/o data dimensionality reduction, adjoint of lib.operators.HS_adjoint_operator_precond_G()).

Parameters
  • x (double[:, :, :]) – Wideband image.

  • G (cell of cell of sparse complex[:, :]) – Degridding matrix or holographic matrix if visibility gridding is active (per channel per block).

  • W (cell of cell of int[:]) – Selection vector to map data blocks to the full Fourier plane.

  • A (anonymous function) – Weighted FFT involved in the NUFFT.

  • aW (cell of cell of double) – Diagonal preconditioning matrices (encoded as vector, for each channel and data block within a channel).

  • flag_visibility_gridding (bool) – Flag indicating whether data dimensionality reduction via visibility gridding is considered.

  • Lambda (cell of cell of double[:]) – Weighting matrix involved in data dimensionality reduction via visibility gridding.

Returns

y – Output visibilities.

Return type

cell of cell of complex[:]

lib.operators.HS_forward_sparsity(x_wave, Psi, n, m)

Apply the adjoint of the SARA dictionary to a wideband image (adjoint of lib.operators.HS_adjoint_sparsity()).

Parameters
  • x_wave (double[:, :]) – Wavelet coefficients in the SARA sparsity domain [b, L].

  • Psi (anonymous function) – Function handle representing the serial implementation of the adjoint SARA dictionary.

  • n (int) – Spatial dimension of the output wideband image (y axis).

  • m (int) – Spatial dimension of the output wideband image (x axis).

Returns

x – Wideband image [n, m, L]

Return type

double[:, :, :]

lib.operators.op_nufft_calib(p, D, N, Nn, No, Ns, S)

Create the nonuniform gridding matrix and fft operators.

Parameters
  • p (double[:, 2]) – Nonuniformly distributed frequency location points.

  • D (complex[:, :]) – DDE kernels (in the Fourier domain).

  • N (int[2]) – Size of the reconstruction image.

  • Nn (int[2]) – Size of the kernels (number of neighbors considered on each direction).

  • No (int[2]) – Oversampled fft from which to recover the non uniform fft via kernel convolution.

  • Ns (int[2]) – FFT shift.

  • S (int[1]) – Size of the DDE support (square support).

Returns

  • A (function handle) – Function handle for direct operator.

  • At (function handle) – Function handle for adjoint operator.

  • Gw (sparse complex[:, :]) – Global convolution kernel matrix.

  • scale (complex[:, :]) – Scale paremters for the oversampled FFT.

lib.operators.op_p_nufft_calib(p, D, N, Nn, No, Ns, S, ww, param)

Create the nonuniform gridding matrix and fft operators to be used for parallel processing

Parameters
  • p (cell of double[:, 2]) – Nonuniformly distributed frequency location points for each cell member which will be treated in parallel.

  • D (complex[:, :]) – DDE kernels (in the Fourier domain).

  • N (int[2]) – Size of the reconstructed image.

  • Nn (int[2]) – Size of the kernels (number of neighbors considered on each direction).

  • No (int[2]) – Oversampled fft from which to recover the non uniform fft via kernel convolution.

  • Ns (int[2]) – FFT shift.

  • S (int[1]) – Size of the DDE support (square support).

  • ww (cell of double[:, 2]) – :math:w component for each cell member which will be treated in parallel.

  • param (struct) – Parameters to build the degridding matrices, composed of the following fields.

  • param.use_nufft_blocks (bool) – Flag to specify NUFFT blocks are used (data blocking).

  • param.gen_only_fft_op (bool) – Flag to only generate the weighted FFT and inverse FFT involved in the the forward and the adjoint NUFFT operators, respectively.

Returns

  • A (function handle) – Function handle for direct operator.

  • At (function handle) – Function handle for adjoint operator.

  • G (cell of sparse complex[:, :]) – Convolution kernel matrix (small) associated with each patch in the Fourier plane.

  • W (cell of int[:]) – Mask of the values that contribute to the convolution.

  • Gw (sparse complex[:, :]) – Global convolution kernel matrix.

lib.operators.util_gen_measurement_operator_synth(u, v, param_precond, param_blocking, fc, fmax, Nx, Ny, Kx, Ky, ox, oy, kernel)

Build the measurement operator for a given uv-coverage at pre-defined frequencies.

Build the measurement operator for a given uv-coverage at pre-defined frequencies.

Parameters
  • u (array (vector)) – u coverage.

  • v (array (vector)) – v coverage.

  • param_precond (struct) – Structure to configure the preconditioning matrices.

  • param_blocking (struct) – Structure to configure data blocking.

  • fc (array (vector)) – Frequencies at which the operator needs to be defined.

  • Nx (int) – Image dimension (x-axis).

  • Ny (int) – Image dimension (y-axis).

  • Kx (int) – Dimension interpolation kernel (x-axis).

  • Ky (int) – Dimension interpolation kernel (y-axis).

  • ox (int) – Fourier oversampling factor(x-axis).

  • oy (int) – Fourier oversampling factor(y-axis).

  • kernel (string) – Selected interpolator (among 'minmax:kb', 'minmax:tuned' and 'kaiser'). Recommended default is 'minmax:kb'.

Returns

  • A (lambda function) – Lambda function to compute the rescaled 2D Fourier transform involved in the emasurement operator.

  • At (lambda function) – Lambda function to compute the adjoint of A.

  • G (cell) – Cell containing the trimmed-down interpolation kernels for each channel, and each data block within a channel.

  • W (cell) – Cell containing the selection vector for each channel, and data block within a channel.

  • aWw (cell) – Cell containing the preconditioning vectors for each channel, and data block within a channel.

lib.operators.util_load_data_gen_dr_measurement_operator(y, dataFilename, effChans2Image, nDataSets, Nx, Ny, param_nufft, param_wproj, preproc_noise_sigma, preproc_filenames)

Build the measurement operator incorporating visibility gridding for a given uv-coverage at pre-defined frequencies.

Parameters
  • y (cell of cell of complex[:]) – Cell containing the data vectors (Stokes I) to be gridded.

  • dataFilename (function handle) – Filenames of the data files to load u, v and w coordinates and nW the weights involved in natural weighting.

  • effChans2Image (cell) – Indices of the physical (input) channels, combined to image the effective (ouput) channel.

  • nDataSets (int) – Number of datasets per physical (input) channel.

  • Nx (int) – Image dimension (x-axis).

  • Ny (int) – Image dimension (y-axis).

  • param_nufft (struct) – Structure to configure NUFFT.

  • param_wproj (struct) – Structure to configure w-projection.

  • param_precond (struct) – Structure to configure the preconditioning matrices.

  • preproc_noise_sigma (cell of doubles) – Standard deviation values of the noise in the physical (input) channels.

  • preproc_filenames (struct) – Struct composed of two fields: (i) preproc_filenames.dde: anonymous functions to get DDE calibration kernel files, expected variable to be loaded DDEs. (ii) preproc_filenames.noise_std: anonymous functions to get the noise-related files, expected variable to be loaded (optional) RESIDUAL residual visibility vector from a preprocessing step, assumed to be a noise vector.

Returns

  • A (function handle) – Function to compute the rescaled 2D Fourier transform involved in the emasurement operator.

  • At (function handle) – Function to compute the adjoint of A.

  • H (cell of cell of complex[:]) – Cell containing the holographic matrix for each channel, and each data block within a channel. H is a lower-triangular matrix to optimise memory requirements.

  • W (cell of cell of double[:]) – Cell containing the selection vector for each channel, and data block within a channel.

  • aWw (cell of cell of double[:]) – Cell containing the preconditioning vectors for each channel, and data block within a channel.

  • Lambda (cell of cell of double) – Cell containing the diagonal weighting matrix involved in data dimensionality reduction via visibility gridding.

  • gridded_y (cell of cell of complex[:]) – Cell containing the reduced data vectors which corresponds to the gridded visibilities.

  • gridded_noise (struct) – struct containing estimated l2bounds and noise std, from gridding a noise data vector.

lib.operators.util_load_data_gen_measurement_operator(dataFilename, effChans2Image, nDataSets, Nx, Ny, param_nufft, param_wproj, param_precond, ddesfilename)

Build the measurement operator for a given uv-coverage at pre-defined frequencies.

Parameters
  • dataFilename (function handle) – Filenames of the data files to load u, v and w coordinates and nW the weights involved in natural weighting.

  • effChans2Image (cell) – Indices of the physical (input) channels, combined to image the effective (ouput) channel.

  • nDataSets (int) – Number of datasets per physical (input) channel.

  • Nx (int) – Image dimension (x-axis).

  • Ny (int) – Image dimension (y-axis).

  • param_nufft (struct) – Structure to configure NUFFT.

  • param_wproj (struct) – Structure to configure w-projection.

  • param_precond (struct) – Structure to configure the preconditioning matrices.

  • ddesfilename (function handle) – Filenames of the DDE calibration kernels in the spatial Fourier domain from a pre-processing step to be incorporated in the measurement operator. Expected variable to be loaded DDEs.