arrakis.imager

Arrkis imager

Module Contents

Classes

ImageSet

Container to organise files related to t he imaging of a measurement set.

Functions

cleanup(→ None)

Utility to remove all images described by an collection of ImageSets. Internally

cleanup_imageset(→ None)

Delete images associated with an input ImageSet

cli()

Command-line interface

fix_ms(→ pathlib.Path)

Apply the corrections to the FEED table of a measurement set that

fix_ms_askap_corrs(→ pathlib.Path)

Applies a correction to raw telescope polarisation products to rotate them

get_beam(→ pathlib.Path)

Derive a common resolution across all images within a set of ImageSet

get_prefix(→ pathlib.Path)

Derive a consistent prefix style from a input MS name.

get_wsclean(→ pathlib.Path)

Pull wsclean image from dockerhub (or wherver).

image_beam(→ ImageSet)

Image a single beam

imager_parser(→ argparse.ArgumentParser)

Return the argument parser for the imager routine.

main(msdir, out_dir[, temp_dir, cutoff, robust, pols, ...])

make_cube(→ Tuple[pathlib.Path, pathlib.Path])

Make a cube from the images

smooth_imageset(→ ImageSet)

Smooth all images described within an ImageSet to a desired resolution

Attributes

TQDM_OUT

class arrakis.imager.ImageSet[source]

Bases: NamedTuple

Container to organise files related to t he imaging of a measurement set.

aux_lists: Dict[Tuple[str, str], List[str]] | None[source]

Dictionary of lists of auxillary images. The keys are a tuple of the polarisation and the image type, and the values are the list of images for that polarisation and image type.

image_lists: Dict[str, List[str]][source]

Dictionary of lists of images. The keys are the polarisations and the values are the list of images for that polarisation.

ms: pathlib.Path[source]

Path to the measurement set that was imaged.

prefix: str[source]

Prefix used for the wsclean output files.

arrakis.imager.cleanup(purge: bool, image_sets: List[ImageSet], ignore_files: List[Any] | None = None) None[source]

Utility to remove all images described by an collection of ImageSets. Internally called cleanup_imageset.

Parameters:
  • purge (bool) – Whether files are actually removed or skipped.

  • image_sets (List[ImageSet]) – Collection of ImageSets that would be deleted

  • ignore_files (Optional, List[Any]) – Collection of items to ignore. Nothing is done with this

  • and is purely used to exploit the dask dependency tracking.

arrakis.imager.cleanup_imageset(purge: bool, image_set: ImageSet) None[source]

Delete images associated with an input ImageSet

Parameters:
  • purge (bool) – Whether files will be deleted or skipped.

  • image_set (ImageSet) – Collection of files that will be removed.

arrakis.imager.cli()[source]

Command-line interface

arrakis.imager.fix_ms(ms: pathlib.Path) pathlib.Path[source]

Apply the corrections to the FEED table of a measurement set that is required for the ASKAP measurement sets.

Parameters:

ms (Path) – Path to the measurement set to fix.

Returns:

Path to the corrected measurement set.

Return type:

Path

arrakis.imager.fix_ms_askap_corrs(ms: pathlib.Path, *args, **kwargs) pathlib.Path[source]

Applies a correction to raw telescope polarisation products to rotate them to the wsclean espected form. This is essentially related to the third-axis of ASKAP and reorientating its ‘X’ and ‘Y’s.

Parameters:

ms (Path) – Path to the measurement set to be corrected.

Returns:

Path of the measurementt set containing the corrections.

Return type:

Path

arrakis.imager.get_beam(image_set: ImageSet, cutoff: float | None) pathlib.Path[source]

Derive a common resolution across all images within a set of ImageSet

Parameters:
  • image_set (ImageSet) – ImageSet that a common resolution will be derived for

  • cuttoff (float, optional) – The maximum major axis of the restoring beam that is allowed when

  • searching for the lowest common beam. Images whose restoring beam’s major acis is larger than

  • this are ignored. Defaults to None.

Returns:

Path to the pickled beam object

Return type:

Path

arrakis.imager.get_prefix(ms: pathlib.Path, out_dir: pathlib.Path) pathlib.Path[source]

Derive a consistent prefix style from a input MS name.

Parameters:
  • ms (Path) – Path to a Measurement Set that a prefix will be derived from

  • out_dir (Path) – The final location that wsclean output data will be written to

Returns:

The prefix, including the output directory name.

Return type:

Path

arrakis.imager.get_wsclean(wsclean: pathlib.Path | str) pathlib.Path[source]

Pull wsclean image from dockerhub (or wherver).

Parameters:

version (str, optional) – wsclean image tag. Defaults to “3.1”.

Returns:

Path to wsclean image.

Return type:

Path

arrakis.imager.image_beam(ms: pathlib.Path, field_idx: int, out_dir: pathlib.Path, temp_dir: pathlib.Path, prefix: pathlib.Path, simage: pathlib.Path, pols: str = 'IQU', nchan: int = 36, scale: float = 2.5, npix: int = 4096, join_polarizations: bool = True, join_channels: bool = True, squared_channel_joining: bool = True, mgain: float = 0.7, niter: int = 100000, auto_mask: float = 3, force_mask_rounds: int | None = None, auto_threshold: float = 1, gridder: str | None = None, robust: float = -0.5, mem: float = 90, absmem: float | None = None, taper: float | None = None, minuv_l: float = 0.0, parallel_deconvolution: int | None = None, nmiter: int | None = None, local_rms: bool = False, local_rms_window: float | None = None, multiscale: bool = False, multiscale_scale_bias: float | None = None, data_column: str = 'CORRECTED_DATA', no_mf_weighting: bool = False, no_update_model_required: bool = True, beam_fitting_size: float | None = 1.25) ImageSet[source]

Image a single beam

arrakis.imager.imager_parser(parent_parser: bool = False) argparse.ArgumentParser[source]

Return the argument parser for the imager routine.

Parameters:

parent_parser (bool, optional) – Ensure the parser is configured so it can be added as a parent to a new parser. This will disables the -h/–help action from being generated. Defaults to False.

Returns:

Arguments required for the imager routine

Return type:

argparse.ArgumentParser

arrakis.imager.main(msdir: pathlib.Path, out_dir: pathlib.Path, temp_dir: pathlib.Path | None = None, cutoff: float | None = None, robust: float = -0.5, pols: str = 'IQU', nchan: int = 36, size: int = 6074, scale: float = 2.5, mgain: float = 0.8, niter: int = 100000, auto_mask: float = 3, force_mask_rounds: int | None = None, auto_threshold: float = 1, taper: float | None = None, purge: bool = False, minuv: float = 0.0, parallel_deconvolution: int | None = None, gridder: str | None = None, nmiter: int | None = None, local_rms: bool = False, local_rms_window: float | None = None, wsclean_path: pathlib.Path | str = 'docker://alecthomson/wsclean:latest', multiscale: bool | None = None, multiscale_scale_bias: float | None = None, absmem: float | None = None, make_residual_cubes: bool | None = False, ms_glob_pattern: str = 'scienceData*_averaged_cal.leakage.ms', data_column: str = 'CORRECTED_DATA', skip_fix_ms: bool = False, no_mf_weighting: bool = False)[source]
arrakis.imager.make_cube(pol: str, image_set: ImageSet, common_beam_pkl: pathlib.Path, aux_mode: str | None = None) Tuple[pathlib.Path, pathlib.Path][source]

Make a cube from the images

arrakis.imager.smooth_imageset(image_set: ImageSet, common_beam_pkl: pathlib.Path, cutoff: float | None = None, aux_mode: str | None = None) ImageSet[source]

Smooth all images described within an ImageSet to a desired resolution

Parameters:
  • image_set (ImageSet) – Container whose image_list will be convolved to common resolution

  • common_beam_pkl (Path) – Location of pickle file with beam description

  • cutoff (Optional[float], optional) – PSF cutoff passed to the beamcon_2D worker. Defaults to None.

  • aux_model (Optional[str], optional) – The image type in the aux_lists property of image_set that contains the images to smooth. If

  • not set then the `image_lists` property of `image_set` is used. Defaults to None.

Returns:

A copy of image_set pointing to the smoothed images. Note the aux_images property is not carried forward.

Return type:

ImageSet

arrakis.imager.TQDM_OUT[source]