katsdpimager.sky_model module

Load a local sky model from file and transfer it to a model image

At present the only file format supported is a katpoint catalogue file, but other formats (e.g. Tigger) may be added later.

class katsdpimager.sky_model.KatpointSkyModel(catalogue)

Bases: katsdpimager.sky_model.SkyModel

Sky model created from a katpoint.Catalogue.

flux_density(wavelength)

Get flux densities for the sources at the given wavelength/frequency.

Parameters

wavelength (Quantity) – Wavelength or frequency

Returns

Flux densities in Jy, shape N×4 for Stokes IQUV

Return type

array

lmn(phase_centre)

Get direction cosine coordinates of the sources

Parameters

phase_centre (Quantity) – RA and DEC of phase centre

Returns

The l/m/n coordinates, shape N×3

Return type

array

exception katsdpimager.sky_model.NoSkyModelError

Bases: Exception

Attempted to load a sky model for continuum subtraction but there isn’t one

class katsdpimager.sky_model.SkyModel

Bases: object

A sky model which can be used to generate images at specified frequencies.

This is an abstract base class.

flux_density(wavelength)

Get flux densities for the sources at the given wavelength/frequency.

Parameters

wavelength (Quantity) – Wavelength or frequency

Returns

Flux densities in Jy, shape N×4 for Stokes IQUV

Return type

array

lmn(phase_centre)

Get direction cosine coordinates of the sources

Parameters

phase_centre (Quantity) – RA and DEC of phase centre

Returns

The l/m/n coordinates, shape N×3

Return type

array

katsdpimager.sky_model.catalogue_from_telstate(telstate, capture_block_id, continuum, target)

Extract a katpoint catalogue written by katsdpcontim.

Parameters
  • telstate (katsdptelstate.TelescopeState or katdal.sensordata.TelstateToStr) – Telescope state

  • capture_block_id (str) – Capture block ID

  • continuum (str or None) – Name of the continuum imaging stream (used to form the telstate view). If None, there must be exactly one continuum imaging stream in the data set, which is used.

  • target (katpoint.Target) – Target field

Raises

NoSkyModelError – If no sky model could be found for the given parameters

Returns

Return type

katpoint.Catalogue

katsdpimager.sky_model.open_sky_model(url)

Load a sky model from an external resource.

The format is encoded in the URL as a format query parameter, and defaults to katpoint.

Parameters

url (str) –

The interpretation depends on the format.

katpoint

A file:// URL for a katpoint catalogue file

katdal

A katdal MVFv4 URL. The following extra query parameters are interpreted and removed before they are passed to katdal:

target (required)

Description of the katpoint target whose LSM should be loaded

continuum (optional)

Name of the continuum image stream. If not specified, there must be exactly one in the file.

Raises
  • ValueError – if format was not recognised, the URL doesn’t contain the expected query parameters, or the URL scheme is not supported

  • IOError, OSError – if there was a low-level error reading a file

  • Exception – any exception raised by katdal in opening the file

Returns

Return type

SkyModel