Module lib.utils

Collection of utility functions used throughout the library.

lib.utils.fb_nnls(y, A, At, param)

Forward-backward algorithm to solve a non-negative least-squares problem of the form

\[\min_{x \in \mathbb{R}^N_+} \frac{1}{2} \| y - Ax \|_2^2,\]

using a FISTA-like acceleration.

Parameters
  • y (complex[:]) – Input measurements.

  • A (function handle) – Forward measurement operator

  • At (function handle) – Adjoint measurement operator.

  • param (strut) – Parameter structure complsed of the following fields.

  • param.verbose (int) – 0 no log, 1 print main steps, 2 print all steps.

  • param.max_iter (int) – Maximum number of iterations (default: 200).

  • param.rel_obj (double) – Minimum relative change of the objective value (default: 1e-4). The algorithm stops if \(| f(x^{(t)}) - f(x^{(t-1)}) | / f(x^{(t)}) < \text{rel}_\text{obj}\), where \(x^{(t)}\) is the estimate of the solution at iteration \(t\).

Returns

  • sol (double[:, :]) – Estimated image.

  • norm_res (double) – Norm of the residual image \(\|y - Ax\|^2_2\).

lib.utils.fb_nnls_blocks(y, A, At, G, W, param)

Forward-backward algorithm to solve a non-negative least-squares problem of the form

\[\min_{x \in \mathbb{R}^N_+} \frac{1}{2} \| y - Ax \|_2^2,\]

using a FISTA-like acceleration.

Parameters
  • y (complex[:]) – Input measurements.

  • A (function handle) – Forward measurement operator

  • At (function handle) – Adjoint measurement operator.

  • G (sparse complex[:, :]) – Degridding matrix.

  • W (int[:]) – [description]

  • param (strut) – Parameter structure complsed of the following fields.

  • param.verbose (int) – 0 no log, 1 print main steps, 2 print all steps.

  • param.max_iter (int) – Maximum number of iterations (default: 200).

  • param.rel_obj (double) – Minimum relative change of the objective value (default: 1e-4). The algorithm stops if \(| f(x^{(t)}) - f(x^{(t-1)}) | / f(x^{(t)}) < \text{rel}_\text{obj}\), where \(x^{(t)}\) is the estimate of the solution at iteration \(t\).

Returns

  • sol (double[:, :]) – Estimated image.

  • norm_res (double) – Norm of the residual image \(\|y - Ax\|^2_2\).

lib.utils.util_antenna_based_block_sp_ar(u, ant2, param)

[extended_summary]

Parameters
  • u ([type]) – [description]

  • ant2 ([type]) – [description]

  • param ([type]) – [description]

Returns

[description]

Return type

[type]

lib.utils.util_gen_data_fidelity_bounds2(y, Ml, param, sigma_noise)

[extended_summary]

Parameters
  • y ([type]) – [description]

  • Ml ([type]) – [description]

  • param ([type]) – [description]

  • sigma_noise ([type]) – [description]

Returns

[description]

Return type

[type]

lib.utils.util_operator_norm(G, W, A, At, aW, Ny, Nx, tol, max_iter, flag_visibility_gridding, Sigma)

[extended_summary]

Parameters
  • G ([type]) – [description]

  • W ([type]) – [description]

  • A ([type]) – [description]

  • At ([type]) – [description]

  • aW ([type]) – [description]

  • Ny ([type]) – [description]

  • Nx ([type]) – [description]

  • tol ([type]) – [description]

  • max_iter ([type]) – [description]

  • flag_visibility_gridding ([type]) – [description]

  • Sigma ([type]) – [description]

Returns

[description]

Return type

[type]

lib.utils.util_rearrange_channels(idChannels2Image, nChannelsPerImage)
lib.utils.util_set_parpool(solver, ncores_data, Q, parcluster_name)

function to launch parpool before the solver.

Parameters
  • algo_version ([string]) – Solver used, ‘fhs’, ‘hs’, or ‘sara’

  • ncores_data ([int]) – number of data workers

  • Q ([int]) – number of facet workers

  • parcluster_name ([string]) – name of the parcluster profile to use, default “local”

Returns

[description]

Return type

hpc_cluster

lib.utils.util_time_based_block_sp_ar(u, time_, param)

[extended_summary]

Parameters
  • u ([type]) – [description]

  • time_ ([type]) – [description]

  • param ([type]) – [description]

Returns

[description]

Return type

[type]