ExtraCoords#

class ndcube.ExtraCoords(ndcube=None)[source]#

Bases: ExtraCoordsABC

A representation of additional world coordinates associated with pixel axes.

ExtraCoords can be initialised by either specifying a BaseLowLevelWCS object and a mapping, or it can be built up by specifying one or more lookup tables.

Parameters:
  • wcs – The WCS specifying the extra coordinates.

  • mapping – The mapping between the array dimensions and pixel dimensions in the extra coords object. This is an iterable of (array_dimension, pixel_dimension) pairs of length equal to the number of pixel dimensions in the extra coords.

Attributes Summary

cube_wcs

Produce a WCS that describes the associated NDCube with just the extra coords.

dropped_world_dimensions

Return an APE-14 like representation of any sliced out world dimensions.

is_empty

Return True if no extra coords present, else return False.

mapping

The mapping between the array dimensions and pixel dimensions.

wcs

A WCS object representing the world coordinates described by this ExtraCoords.

Methods Summary

add(name, array_dimension, lookup_table[, ...])

Add a coordinate to this ExtraCoords based on a lookup table.

from_lookup_tables(names, pixel_dimensions, ...)

Construct a new ExtraCoords instance from lookup tables.

keys()

The world axis names for all the coordinates in the extra coords.

resample(factor[, offset, ndcube])

Resample all extra coords by given factors in array-index-space.

Attributes Documentation

cube_wcs#

Produce a WCS that describes the associated NDCube with just the extra coords.

For NDCube pixel axes without any extra coord, dummy axes are inserted.

dropped_world_dimensions#

Return an APE-14 like representation of any sliced out world dimensions.

is_empty#
mapping#
wcs#

Methods Documentation

add(name, array_dimension, lookup_table, physical_types=None, **kwargs)[source]#

Add a coordinate to this ExtraCoords based on a lookup table.

Parameters:
  • name (str or sequence of str) – The name(s) for these world coordinate(s).

  • array_dimension (int or tuple of int) – The array dimension(s), to which this lookup table corresponds.

  • lookup_table (object or sequence of object) – The lookup table. A BaseTableCoordinate subclass or anything that can instantiate one, i.e. currently a Time, SkyCoord, or a (sequence of) Quantity.

  • physical_types (str or iterable of str, optional) – Descriptor(s) of the <dimensions and physical types associated with each axis; length must match the number of dimensions in lookup_table.

classmethod from_lookup_tables(names, pixel_dimensions, lookup_tables, physical_types=None)[source]#

Construct a new ExtraCoords instance from lookup tables.

This is a convenience wrapper around ndcube.ExtraCoords.add which does not expose all the options available in that method.

Parameters:
  • names (tuple of str) – The names of the world coordinates.

  • pixel_dimensions (tuple of int) – The pixel dimensions (in the array) to which the lookup_tables apply. Must be the same length as lookup_tables.

  • lookup_tables (iterable of object) – The lookup tables which specify the world coordinates for the pixel_dimensions. Must be BaseTableCoordinate subclass instances or objects from which to instantiate them (see ndcube.ExtraCoords.add).

  • physical_types (sequence of str or of sequences of str, optional) – Descriptors of the Shape and physical types associated with each axis in the tables. Must be the same length as lookup_tables; and length of each element must match the number of dimensions in corresponding lookup_tables[i]. Defaults to None.

Returns:

ndcube.ExtraCoords

keys()[source]#

The world axis names for all the coordinates in the extra coords.

resample(factor, offset=0, ndcube=None, **kwargs)[source]#

Resample all extra coords by given factors in array-index-space.

One resample factor must be supplied for each array axis in array-axis order.

Parameters:
  • factor (int, float, or iterable thereof.) – The factor by which each array axis is resampled. If scalar, same factor is applied to all axes. Otherwise a factor for each axis must be provided.

  • offset (int, float, or iterable therefore.) – The location on the underlying grid which corresponds to the zeroth element after resampling. If iterable, must have an entry for each dimension. If a scalar, the grid will be shifted by the same amount in all dimensions.

  • ndcube (NDCube) – The NDCube instance with which the output ExtraCoords object is associated.

  • kwargs – All remaining kwargs are passed to numpy.interp.

Returns:

new_ec (ExtraCoords) – A new ExtraCoords object holding the interpolated coords.