karabo.imaging.imager_rascil
Overview
This package summarizes legacy tools and functions for the RASCIL imager.
RASCIL imaging remains available during the transitional release, but it is
deprecated. New workflows should prefer the common backend interface with
get_imager(ImagingBackend.SDP) or get_imager(ImagingBackend.WSCLEAN).
Warning
RASCIL support is deprecated and will be removed in a future release. Prefer SDP for Karabo-native imaging, or WSClean when you need WSClean imaging through the common backend interface.
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.
- imaging_npixel
see DirtyImagerConfig
- Type:
int
- imaging_cellsize
see DirtyImagerConfig
- Type:
float
- combine_across_frequencies
see DirtyImagerConfig
- Type:
bool
- override_cellsize
Override the cellsize if it is above the critical cellsize. Defaults to False.
- Type:
bool
- __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.
- config
Config containing parameters for RASCIL dirty imaging.
- Type:
- __init__(config: RascilDirtyImagerConfig) None
Initializes the instance with a config.
- Parameters:
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.
- 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 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.
- ingest_dd
Data descriptors in MS to read (all must have the same number of channels). Defaults to [0].
- Type:
List[int]
- ingest_vis_nchan
Number of channels in a single data descriptor in the MS. Defaults to None.
- Type:
Optional[int]
- ingest_chan_per_vis
Number of channels per blockvis (before any average). Defaults to 1.
- Type:
int
- imaging_nchan
Number of channels per image. Defaults to 1.
- Type:
int
- imaging_w_stacking
Use the improved w stacking method in Nifty Gridder?. Defaults to True.
- Type:
Union[bool, str]
- imaging_flat_sky
If using a primary beam, normalise to
- Type:
Union[bool, str]
- flat sky? Defaults to False.
- override_cellsize
Override the cellsize if it is above the critical cellsize? Defaults to False.
- Type:
bool
- imaging_uvmax
TODO. Defaults to None.
- Type:
Optional[float]
- imaging_uvmin
TODO. Defaults to 0.
- Type:
float
- imaging_dft_kernel
DFT kernel: cpu_looped | gpu_raw. Defaults to None.
- Type:
Optional[DftKernelType]
- client
Dask client. Defaults to None.
- Type:
Optional[Client]
- use_dask
Use dask? Defaults to False.
- Type:
bool
- n_threads
n_threads per worker. Defaults to 1.
- Type:
int
- use_cuda
Use CUDA for Nifty Gridder? Defaults to False.
- Type:
bool
- img_context
Which nifty gridder to use. Defaults to “ng”.
- Type:
ImageContextType
- clean_algorithm
Deconvolution algorithm (hogbom or msclean or mmclean). Defaults to “hogbom”.
- Type:
CleanAlgorithmType
- clean_beam
major axis, minor axis, position angle (deg). Defaults to None.
- Type:
Optional[Dict[CleanBeamInDegType, float]]
- clean_scales
Scales for multiscale clean (pixels) e.g. [0, 6, 10]. Defaults to [0].
- Type:
List[int]
- clean_nmoment
Number of frequency moments in mmclean (1=constant, 2=linear). Defaults to 4.
- Type:
int
- clean_nmajor
Number of major cycles in cip or ical. Defaults to 5.
- Type:
int
- clean_niter
Number of minor cycles in CLEAN. Defaults to 1000.
- Type:
int
- clean_psf_support
Half-width of psf used in cleaning (pixels). Defaults to 256.
- Type:
int
- clean_gain
Clean loop gain. Defaults to 0.1.
- Type:
float
- clean_threshold
Clean stopping threshold (Jy/beam). Defaults to 1e-4.
- Type:
float
- clean_component_threshold
Sources with absolute flux > this level (Jy) are fit or extracted using skycomponents. Defaults to None.
- Type:
Optional[float]
- clean_component_method
Method to convert sources in image to skycomponents: “fit” in frequency or “extract” actual values. Defaults to “fit”.
- Type:
CleanComponentMethodType
- clean_fractional_threshold
Fractional stopping threshold for major cycle. Defaults to 0.3.
- Type:
float
- clean_facets
axis. Defaults to 1.
- Type:
int
- clean_overlap
Overlap of facets in clean (pixels). Defaults to 32.
- Type:
int
- clean_taper
Type of interpolation between facets in deconvolution: none or linear or tukey. Defaults to “tukey”.
- Type:
CleanTaperType
- clean_restore_facets
Number of overlapping facets in restore step along each axis. Defaults to 1.
- Type:
int
- clean_restore_overlap
Overlap of facets in restore step (pixels). Defaults to 32.
- Type:
int
- clean_restore_taper
Type of interpolation between facets in restore step (none, linear or tukey). Defaults to “tukey”.
- Type:
CleanTaperType
- clean_restored_output
Type of restored image output: taylor, list, or integrated. Defaults to “list”.
- Type:
CleanRestoredOutputType
- __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.
- config
Config containing parameters for RASCIL image cleaning.
- Type:
- __init__(config: RascilImageCleanerConfig) None
Initializes the instance with a config.
- Parameters:
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.
- 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:
- 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.
- Parameters:
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