image_raster_iter

ska_sdp_func_python.image.iterators.image_raster_iter(im: Image, facets=1, overlap=0, taper='flat', make_flat=False)[source]

Create an image_raster_iter generator, returning a list of subimages, optionally with overlaps.

The WCS is adjusted appropriately for each raster element. Hence, this is a coordinate-aware way to iterate through an image.

The argument make_flat means that the subimages contain constant values. This is useful for dealing with overlaps in gather operations.

Provided we don’t break reference semantics, memory should be conserved. However, make_flat creates a new set of images and thus reference semantics don’t hold.

To update the image in place:

for r in image_raster_iter(im, facets=2):
    r["pixels"].data[...] = numpy.sqrt(r["pixels"].data[...])

Note that some combinations of image size, facets, and overlap are invalid. In these cases, an exception (ValueError) is raised.

In the case where make_flat is true, the subimages returned have tapers applied in the overlap region. This is used by py:func:gather_scatter.image_gather_facets to merge subimages into one image.

A taper is applied in the overlap regions. None implies a constant value, linear is a ramp, quadratic is parabolic at the ends, and tukey is the tukey function.

Parameters:
  • im – Image

  • facets – Number of image partitions on each axis (2)

  • overlap – Overlap in pixels

  • taper – Method of tapering at the edges: ‘flat’ or ‘linear’ or ‘quadratic’ or ‘tukey’

  • make_flat – Make the flat images

Returns:

Generator of images

See also

ska_sdp_func_python.image.gather_scatter.image_gather_facets() ska_sdp_func_python.image.gather_scatter.image_scatter_facets() ska_sdp_func_python.util.array_functions.tukey_filter()