flint.imageset

The images and auxiliary products made by an imager, and operations on sets of them

Classes

ImageSet

A structure to represent the images and auxiliary products produced by an imager

Functions

combine_image_set_to_cube(→ ImageSet)

Combine wsclean subband channel images into a cube. Each collection attribute

form_stokes_i(→ ImageSet)

Replace the XX and YY images of an image set by Stokes I.

merge_image_sets(→ ImageSet)

Merge the image sets from multiple wsclean results into a single image set.

split_and_get_image_set(→ list[pathlib.Path])

Split an ImageSet by a given field and return the images that match the field of interest.

split_image_set(→ dict[str, list[pathlib.Path]])

Split an ImageSet by a given field.

transpose_and_sort_channel_images(...)

Regroup per-beam lists of sub-band channel images into per-channel lists

write_stokes_i(→ pathlib.Path)

Write I = (XX + YY) / 2 to i_path, raising ValueError if the restoring beams differ

Module Contents

class flint.imageset.ImageSet(/, **data: Any)[source]

Bases: flint.options.BaseOptions

A structure to represent the images and auxiliary products produced by an imager

dirty: list[pathlib.Path] | None = None[source]

Dirty images.

image: list[pathlib.Path][source]

Images produced.

model: list[pathlib.Path] | None = None[source]

Model images.

prefix: str[source]

Prefix of the images and other output products. For wsclean this is its -name argument

psf: list[pathlib.Path] | None = None[source]

References to the PSFs produced by the imager.

residual: list[pathlib.Path] | None = None[source]

Residual images.

source_list: pathlib.Path | None = None[source]

Path to a source list that accompanies the image data

flint.imageset.combine_image_set_to_cube(image_set: ImageSet, fitscube_options: flint.options.FitsCubeOptions) → ImageSet[source]

Combine wsclean subband channel images into a cube. Each collection attribute of the input image_set will be inspected. The MFS images will be ignored.

A output file name will be generated based on the prefix and mode (e.g. image, residual, psf, dirty).

Parameters:
  • image_set (ImageSet) – Collection of wsclean image productds

  • fitscube_options (FitsCubeOptions) – Options to control the cube creation, forwarded to combine_images_to_cube for each mode

Returns:

Updated iamgeset describing the new outputs

Return type:

ImageSet

flint.imageset.form_stokes_i(image_set: ImageSet) → ImageSet[source]

Replace the XX and YY images of an image set by Stokes I.

Each XX image pairs with the YY image named the same but for its xx field, and I is named with i there. The prefix and the PSF, which XX and YY share, are renamed likewise. Raises NamingException if the images are not all in pairs. The XX and YY images are left for the caller.

flint.imageset.merge_image_sets(image_sets: list[ImageSet]) → ImageSet[source]

Merge the image sets from multiple wsclean results into a single image set.

Parameters:

wsclean_results (List[WSCleanResult]) – The results of multiple wsclean imaging runs

Returns:

The merged image set

Return type:

ImageSet

flint.imageset.split_and_get_image_set(image_set: ImageSet, get: str, by: str = 'pol', mode: str = 'image') → list[pathlib.Path][source]

Split an ImageSet by a given field and return the images that match the field of interest.

Parameters:
  • image_set (ImageSet) – The ImageSet to split

  • get (str) – The field to extract from the split images

  • by (str, optional) – The field to split by. Defaults to “pol”.

  • mode (str, optional) – The mode to extract from ImageSet. Defaults to “image”.

Raises:

NamingException – If the field to split by is not found in the ImageSet

Returns:

The images that match the field of interest

Return type:

list[Path]

flint.imageset.split_image_set(image_set: ImageSet, by: str = 'pol', mode: str = 'image') → dict[str, list[pathlib.Path]][source]

Split an ImageSet by a given field.

Parameters:
  • image_set (ImageSet) – The ImageSet to split

  • by (str, optional) – Field to split images by. Defaults to “pol”.

  • mode (str, optional) – Type of images to extract from ImageSet. Defaults to “image”.

Raises:

NamingException – If the field to split by is not found in the ImageSet

Returns:

_description_

Return type:

dict[str, list[Path]]

flint.imageset.transpose_and_sort_channel_images(beam_channel_images: list[list[pathlib.Path]]) → list[list[pathlib.Path]][source]

Regroup per-beam lists of sub-band channel images into per-channel lists of beam images, ready to be co-added one channel at a time.

Each beam’s images are sorted by their channel range, and every beam must contribute the same number of channels.

Parameters:

beam_channel_images (list[list[Path]]) – For each beam, the list of its per-channel images.

Returns:

For each channel, the list of beam images at that channel.

Return type:

list[list[Path]]

flint.imageset.write_stokes_i(xx_path: pathlib.Path, yy_path: pathlib.Path, i_path: pathlib.Path) → pathlib.Path[source]

Write I = (XX + YY) / 2 to i_path, raising ValueError if the restoring beams differ