Image

class ska_sdp_datamodels.image.Image(data_vars=None, coords=None, attrs=None)[source]

Bases: Dataset

Image class with pixels as an xarray.DataArray and the AstroPy`implementation of a World Coordinate System <http://docs.astropy.org/en/stable/wcs>`_

The actual image values are kept in a data_var of the xarray.Dataset called “pixels”.

Many operations can be done conveniently using xarray processing_components on Image or on numpy operations on Image[“pixels”].data. If the “pixels” data variable is chunked then Dask is automatically used wherever possible to distribute processing.

Here is an example:

<xarray.Image>
Dimensions:       (chan: 3, pol: 4, x: 256, y: 256)
Coordinates:
    frequency     (chan) float64 1e+08 1.01e+08 1.02e+08
    polarisation  (pol) <U1 'I' 'Q' 'U' 'V'
  * y             (y) float64 -35.11 -35.11  ... -34.89 -34.89
  * x             (x) float64 179.9 179.9  ... 180.1 180.1
    ra            (x, y) float64 180.1 180.1  ... 179.9 179.9
    dec           (x, y) float64 -35.11 -35.11  ... -34.89 -34.89
Dimensions without coordinates: chan, pol
Data variables:
    pixels        (chan, pol, y, x) float64 0.0 0.0  ... 0.0 0.0
Attributes:
    data_model:     Image
    frame:          icrs

Methods Summary

constructor(data, polarisation_frame, wcs[, ...])

Create an Image

Methods Documentation

classmethod constructor(data, polarisation_frame, wcs, clean_beam=None)[source]

Create an Image

Note that the spatial coordinates x, y are linear. ra, dec coordinates can be added later.

The addition of ra, dec grid enables selections such as:

\[secd = 1.0 / numpy.cos(numpy.deg2rad(im.dec_grid)) r = numpy.hypot( (im.ra_grid - im.ra) * secd, im.dec_grid - im.image.dec, ) show_image(im.where(r < 0.3, 0.0)) plt.show()\]
Parameters:
  • data – pixel values; dims = [nchan, npol, ny, nx]

  • polarisation_frame – as a PolarisationFrame object

  • wcs – WCS object (with naxis=4 to match dims of data)

  • clean_beam – dict e.g. {“bmaj”:0.1, “bmin”:0.05, “bpa”:-60.0}. Units are deg, deg, deg

Returns:

Image (i.e. xarray.Dataset)