karabo.imaging.imager_rascil
Overview
This package summerizes tools and functions to be used with the imager from the RASCIL backend. This backend allows both calculating a dirty images and a cleaned image, respoectivley.
Classes
- class RascilDirtyImagerConfig(imaging_npixel: int, imaging_cellsize: float, combine_across_frequencies: bool = True, override_cellsize: bool = False)
Config / parameters of a RascilDirtyImager.
Adds parameters specific to RascilDirtyImager.
- Attributes:
imaging_npixel (int): see DirtyImagerConfig imaging_cellsize (float): see DirtyImagerConfig combine_across_frequencies (bool): see DirtyImagerConfig override_cellsize (bool): Override the cellsize if it is
above the critical cellsize. Defaults to False.
- __init__(imaging_npixel: int, imaging_cellsize: float, combine_across_frequencies: bool = True, override_cellsize: bool = False) None
- class RascilDirtyImager(config: RascilDirtyImagerConfig)
Dirty imager based on the RASCIL library.
- Attributes:
- config (RascilDirtyImagerConfig): Config containing parameters for
RASCIL dirty imaging.
- __init__(config: RascilDirtyImagerConfig) None
Initializes the instance with a config.
- Args:
config (RascilDirtyImagerConfig): see config attribute
- create_dirty_image(visibility: Visibility, /, *, output_fits_path: Path | str | None = None) Image
Creates a dirty image from a visibility.
- Args:
- 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:
Image: Dirty image
- class RascilImageCleanerConfig(imaging_npixel: int, imaging_cellsize: float, ingest_dd: ~typing.List[int] = <factory>, ingest_vis_nchan: int | None = None, ingest_chan_per_vis: int = 1, imaging_nchan: int = 1, imaging_w_stacking: bool | str = True, imaging_flat_sky: bool | str = False, override_cellsize: bool = False, imaging_uvmax: float | None = None, imaging_uvmin: float = 0, imaging_dft_kernel: ~typing.Literal['cpu_looped', 'gpu_raw'] | None = None, client: ~distributed.client.Client | None = None, use_dask: bool = False, n_threads: int = 1, use_cuda: bool = False, img_context: ~typing.Literal['awprojection', '2d', 'ng', 'wg'] = 'ng', clean_algorithm: ~typing.Literal['hogbom', 'msclean', 'mmclean'] = 'hogbom', clean_beam: ~typing.Dict[~typing.Literal['bmaj', 'bmin', 'bpa'], float] | None = None, clean_scales: ~typing.List[int] = <factory>, clean_nmoment: int = 4, clean_nmajor: int = 5, clean_niter: int = 1000, clean_psf_support: int = 256, clean_gain: float = 0.1, clean_threshold: float = 0.0001, clean_component_threshold: float | None = None, clean_component_method: ~typing.Literal['fit', 'extract'] = 'fit', clean_fractional_threshold: float = 0.3, clean_facets: int = 1, clean_overlap: int = 32, clean_taper: ~typing.Literal['none', 'linear', 'tukey'] = 'tukey', clean_restore_facets: int = 1, clean_restore_overlap: int = 32, clean_restore_taper: ~typing.Literal['none', 'linear', 'tukey'] = 'tukey', clean_restored_output: ~typing.Literal['taylor', 'list', 'integrated'] = 'list')
Config / parameters of a RascilImageCleaner.
Adds parameters specific to RascilImageCleaner.
- Parameters:
imaging_npixel – see ImageCleanerConfig
imaging_cellsize – see ImageCleanerConfig
ingest_dd – Data descriptors in MS to read (all must have the same number of channels). Defaults to [0].
ingest_vis_nchan – Number of channels in a single data descriptor in the MS. Defaults to None.
ingest_chan_per_vis – Number of channels per blockvis (before any average). Defaults to 1.
imaging_nchan – Number of channels per image. Defaults to 1.
imaging_w_stacking – Use the improved w stacking method in Nifty Gridder. Defaults to True.
imaging_flat_sky – If using a primary beam, normalise to flat sky. Defaults to False.
override_cellsize – Override the cellsize if it is above the critical cellsize. Defaults to False.
imaging_uvmax – TODO. Defaults to None.
imaging_uvmin – TODO. Defaults to 0.
imaging_dft_kernel – DFT kernel: cpu_looped | gpu_raw. Defaults to None.
client – Dask client. Defaults to None.
use_dask – Use dask? Defaults to False.
n_threads – n_threads per worker. Defaults to 1.
use_cuda – Use CUDA for Nifty Gridder? Defaults to False.
img_context – Which nifty gridder to use. Defaults to “ng”.
clean_algorithm – Deconvolution algorithm (hogbom or msclean or mmclean). Defaults to “hogbom”.
clean_beam – major axis, minor axis, position angle (deg). Defaults to None.
clean_scales – Scales for multiscale clean (pixels) e.g. [0, 6, 10]. Defaults to [0].
clean_nmoment – Number of frequency moments in mmclean (1=constant, 2=linear). Defaults to 4.
clean_nmajor – Number of major cycles in cip or ical. Defaults to 5.
clean_niter – Number of minor cycles in CLEAN. Defaults to 1000.
clean_psf_support – Half-width of psf used in cleaning (pixels). Defaults to 256.
clean_gain – Clean loop gain. Defaults to 0.1.
clean_threshold – Clean stopping threshold (Jy/beam). Defaults to 1e-4.
clean_component_threshold – Sources with absolute flux > this level (Jy) are fit or extracted using skycomponents. Defaults to None.
clean_component_method – Method to convert sources in image to skycomponents: “fit” in frequency or “extract” actual values. Defaults to “fit”.
clean_fractional_threshold – Fractional stopping threshold for major cycle. Defaults to 0.3.
clean_facets – Number of overlapping facets in faceted clean along each axis. Defaults to 1.
clean_overlap – Overlap of facets in clean (pixels). Defaults to 32.
clean_taper – Type of interpolation between facets in deconvolution: none or linear or tukey. Defaults to “tukey”.
clean_restore_facets – Number of overlapping facets in restore step along each axis. Defaults to 1.
clean_restore_overlap – Overlap of facets in restore step (pixels). Defaults to 32.
clean_restore_taper – Type of interpolation between facets in restore step (none, linear or tukey). Defaults to “tukey”.
clean_restored_output – Type of restored image output: taylor, list, or integrated. Defaults to “list”.
- __init__(imaging_npixel: int, imaging_cellsize: float, ingest_dd: ~typing.List[int] = <factory>, ingest_vis_nchan: int | None = None, ingest_chan_per_vis: int = 1, imaging_nchan: int = 1, imaging_w_stacking: bool | str = True, imaging_flat_sky: bool | str = False, override_cellsize: bool = False, imaging_uvmax: float | None = None, imaging_uvmin: float = 0, imaging_dft_kernel: ~typing.Literal['cpu_looped', 'gpu_raw'] | None = None, client: ~distributed.client.Client | None = None, use_dask: bool = False, n_threads: int = 1, use_cuda: bool = False, img_context: ~typing.Literal['awprojection', '2d', 'ng', 'wg'] = 'ng', clean_algorithm: ~typing.Literal['hogbom', 'msclean', 'mmclean'] = 'hogbom', clean_beam: ~typing.Dict[~typing.Literal['bmaj', 'bmin', 'bpa'], float] | None = None, clean_scales: ~typing.List[int] = <factory>, clean_nmoment: int = 4, clean_nmajor: int = 5, clean_niter: int = 1000, clean_psf_support: int = 256, clean_gain: float = 0.1, clean_threshold: float = 0.0001, clean_component_threshold: float | None = None, clean_component_method: ~typing.Literal['fit', 'extract'] = 'fit', clean_fractional_threshold: float = 0.3, clean_facets: int = 1, clean_overlap: int = 32, clean_taper: ~typing.Literal['none', 'linear', 'tukey'] = 'tukey', clean_restore_facets: int = 1, clean_restore_overlap: int = 32, clean_restore_taper: ~typing.Literal['none', 'linear', 'tukey'] = 'tukey', clean_restored_output: ~typing.Literal['taylor', 'list', 'integrated'] = 'list') None
- class RascilImageCleaner(config: RascilImageCleanerConfig)
Image cleaner based on the RASCIL library.
- Attributes:
- config (RascilImageCleanerConfig): Config containing parameters for
RASCIL image cleaning.
- __init__(config: RascilImageCleanerConfig) None
Initializes the instance with a config.
- Args:
config (RascilImageCleanerConfig): see config attribute
- 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.
- Arguments:
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:
Image: Clean image
- create_cleaned_image_variants(visibility: Visibility, /, deconvolved_fits_path: Path | str | None = None, restored_fits_path: Path | str | None = None, residual_fits_path: Path | str | None = None) Tuple[Image, Image, Image]
Creates a clean image from visibilities.
- Args:
- visibility: Visibility from which a clean image should be created.
Please note: only MS visibilities supported.
- deconvolved_fits_path: Path to write the deconvolved image to.
Example: /tmp/deconvolved.fits. If None, will be set to a temporary directory and a default file name.
- restored_fits_path: Path to write the restored image to.
Example: /tmp/restored.fits. If None, will be set to a temporary directory and a default file name.
- residual_fits_path: Path to write the residual image to.
Example: /tmp/residual.fits. If None, will be set to a temporary directory and a default file name.
- Returns:
A tuple (deconvolved, restored, residual) of images