ivis.imager

Imager module for joint deconvolution using GPU-accelerated optimization.

This module provides the Imager class which performs non-linear optimization combining interferometric and single-dish data.

Author: Antoine Marchal

Classes

Imager(vis_data, pb, grid, sd, beam_sd, hdr, ...)

A GPU-accelerated imager for joint deconvolution of interferometric and single-dish data.

Imager3D(vis_data, pb, grid, sd, beam_sd, ...)

GPU-accelerated imager for joint deconvolution of interferometric and single-dish data, using the new VisIData dataclass.

class ivis.imager.Imager(vis_data, pb, grid, sd, beam_sd, hdr, init_params, max_its, lambda_sd, positivity, device, beam_workers)[source]

Bases: object

A GPU-accelerated imager for joint deconvolution of interferometric and single-dish data.

Parameters:
  • vis_data (object) – Visibility data structure containing uvw coordinates, visibilities, and beam info.

  • pb (ndarray) – Primary beam model array.

  • grid (ndarray) – Grid array for SIN projection evaluation.

  • sd (ndarray) – Single-dish map used for zero-spacing constraint.

  • beam_sd (radio_beam.Beam) – Beam object for the single-dish map.

  • hdr (dict) – FITS header containing WCS and shape information.

  • init_params (ndarray) – Initial parameters (not flattened).

  • max_its (int) – Maximum number of iterations for the optimizer.

  • lambda_sd (float) – Regularization strength for the single-dish constraint.

  • lambda_r (float) – Regularization strength for the spatial prior (e.g., Laplacian).

  • positivity (bool) – Whether to enforce a positivity constraint during optimization.

  • device (int or str) – Device to use: 0 for GPU, ‘cpu’ for CPU.

  • beam_workers (int) – Number of workers for parallel beam convolution.

forward_model(model, x=None)[source]

Compute model visibilities from an input image using the provided model’s forward operator.

Parameters:
  • model (object) – A model instance (e.g., ClassicIViS) that implements a .forward(…) method to simulate visibilities from image-domain parameters.

  • x (np.ndarray or None, optional) – Image parameters to forward-project. If None, uses self.init_params.

Returns:

model_vis – Complex model visibilities, one per (u,v) coordinate in the data.

Return type:

np.ndarray

Raises:

ValueError – If no model is provided.

Notes

  • Converts spatial frequencies to units of radians per pixel based on image header.

  • Uses internal primary beam and interpolation grid arrays.

  • Forwards all necessary inputs to the model’s forward method.

static get_device(user_device)[source]

Selects the appropriate compute device (CPU or GPU) based on availability and user request.

Parameters:

user_device (int or str) – 0 to request GPU, otherwise uses CPU.

Returns:

The selected torch device.

Return type:

torch.device

process(model=None, units='Jy/arcsec^2', disk=False)[source]

Runs the imaging optimization pipeline and returns a restored image in the requested unit.

Parameters:
  • model (object) – An imaging model instance implementing a .loss(x, …) method compatible with scipy.optimize.minimize.

  • units (str) – Output unit. Must be one of: ‘Jy/arcsec^2’, ‘Jy/beam’, or ‘K’.

  • disk (bool, optional) – If True, writes intermediate results to disk (currently unused).

Returns:

result – Restored image in the requested unit.

Return type:

ndarray

process_beam_positions()[source]

Determines the first and last indices for each beam in the visibility dataset.

Returns:

  • idmin (ndarray of int) – First occurrence index for each beam.

  • idmax (ndarray of int) – Last occurrence index (exclusive upper bound) for each beam.

class ivis.imager.Imager3D(vis_data, pb, grid, sd, beam_sd, hdr, init_params, max_its, lambda_sd, positivity, cost_device='auto', optim_device='auto', beam_workers=0)[source]

Bases: object

GPU-accelerated imager for joint deconvolution of interferometric and single-dish data, using the new VisIData dataclass.

adjoint_model(model, vis=None, return_real=False)[source]

Apply the backward/adjoint of the model forward operator to a visibility cube or flat visibility vector. If vis is None, uses self.vis_data.data_I.

forward_model(model, x=None)[source]

Compute model visibilities from the current image parameters using the given model’s forward operator.

process(model=None, solver='LBFGS', units='Jy/arcsec^2', history_size=10, dtype=torch.float32)[source]

Devices

  • optim_device: where PyTorch LBFGS params/optimizer live

  • cost_device : where model.objective() runs

Rules #FIXME

  • positivity=True -> SciPy L-BFGS-B (CPU-only optimizer)

  • positivity=False -> PyTorch LBFGS on optim_device; cost on cost_device

Notes

objective() is expected to call backward() internally (unchanged).