Common Imaging API
Use the factory and shared interface for backend-switched imaging. See Imaging Backend Selection for examples and current adapter limitations.
Interface and factory
- class ImageSpec(npix: int, cellsize_arcsec: float, phase_centre_deg: Tuple[float, float], polarisation: str = 'I', nchan: int = 1)
Minimal imaging parameters shared across backends.
- property cellsize_radians: float
Return the pixel scale in radians.
- class Imager
Backend-agnostic imaging interface.
- abstractmethod invert(vis: Visibility, image_spec: ImageSpec) tuple[Image, Image]
Grid visibilities into dirty image and PSF images.
- parse_imaging_backend(backend: str | ImagingBackend | None = None) ImagingBackend
- get_imager(backend: str | ImagingBackend | None = None, *, config: SdpImagerConfig | WscleanBackendConfig | None = None) Imager
Direct-imager base classes
These lower-level classes support the direct OSKAR dirty imager and the direct
WSClean implementation. They are not the backend-neutral Imager interface.
Their imaging_cellsize parameter uses radians; ImageSpec uses arcseconds.
- class DirtyImagerConfig(imaging_npixel: int, imaging_cellsize: float, combine_across_frequencies: bool = True)
Base class for the config / parameters of a dirty imager.
Contains basic parameters common across all dirty imagers. Inherit and add parameters specific to a dirty imager implementation.
- imaging_npixel
Image size
- Type:
int
- imaging_cellsize
Scale of a pixel in radians
- Type:
float
- combine_across_frequencies
Whether or not to combine images across all frequency channels into one image. Defaults to True.
- Type:
bool
- __init__(imaging_npixel: int, imaging_cellsize: float, combine_across_frequencies: bool = True) None
- class DirtyImager
Abstract base class for a dirty imager.
A dirty imager creates dirty images from visibilities.
- abstractmethod create_dirty_image(visibility: Visibility, /, *, output_fits_path: Path | str | None = None) Image
Creates a dirty image from a visibility.
- Parameters:
visibility – Visibility object from which to create the dirty image. Contains the visibilities of an observation.
output_fits_path – Path to write the dirty image to. Example: /tmp/dirty.fits. If None, will be set to a temporary directory and a default file name. Defaults to None.
- Returns:
Dirty image
- Return type:
- class ImageCleanerConfig(imaging_npixel: int, imaging_cellsize: float)
Base class for the config / parameters of an image cleaner.
Contains basic parameters common across all image cleaners. Inherit and add parameters specific to an image cleaner implementation.
- imaging_npixel
Image size
- Type:
int
- imaging_cellsize
Scale of a pixel in radians
- Type:
float
- __init__(imaging_npixel: int, imaging_cellsize: float) None
- class ImageCleaner
Abstract base class for an image cleaner.
An image cleaner creates clean images from dirty images or directly from visibilities, in that case including the dirty imaging process.
- abstractmethod create_cleaned_image(visibility: Visibility, /, *, dirty_fits_path: Path | str | None = None, output_fits_path: Path | str | None = None) Image
Creates a clean image from a dirty image or from visibilities.
- Parameters:
visibility – Visibility from which a clean image should be created.
dirty_fits_path – Path to dirty image FITS file that should be reused to create a clean image. If None, dirty image will be created first from the visibilities. Defaults to None.
output_fits_path – Path to write the clean image to. Example: /tmp/restored.fits. If None, will be set to a temporary directory and a default file name. Defaults to None.
- Returns:
Clean image
- Return type: