AffineCoordinates

class glue.core.coordinates.AffineCoordinates(matrix, units=None, labels=None)[source]

Bases: glue.core.coordinates.Coordinates

Coordinates determined via an affine transformation represented by an augmented matrix of shape N+1 x N+1 matrix, where N is the number of pixel and world coordinates. The last column of the matrix should be used for the translation term, and the last row should be set to 0 except for the last column which should be 1.

Note that the order of the dimensions in the matrix (x, y) should be the opposite of the order of the order of dimensions of Numpy arrays (y, x).

Attributes Summary

world_axis_names

An iterable of strings describing the name for each world axis.

world_axis_units

An iterable of strings given the units of the world coordinates for each axis.

Methods Summary

pixel_to_world_values(*pixel)

Convert pixel coordinates to world coordinates.

world_to_pixel_values(*world)

Convert world coordinates to pixel coordinates.

Attributes Documentation

world_axis_names[source]
world_axis_units[source]

Methods Documentation

pixel_to_world_values(*pixel)[source]

Convert pixel coordinates to world coordinates.

This method takes ~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim scalars or arrays as input, and pixel coordinates should be zero-based. Returns ~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim scalars or arrays in units given by ~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units. Note that pixel coordinates are assumed to be 0 at the center of the first pixel in each dimension. If a pixel is in a region where the WCS is not defined, NaN can be returned. The coordinates should be specified in the (x, y) order, where for an image, x is the horizontal coordinate and y is the vertical coordinate.

If ~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim is 1, this method returns a single scalar or array, otherwise a tuple of scalars or arrays is returned.

world_to_pixel_values(*world)[source]

Convert world coordinates to pixel coordinates.

This method takes ~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim scalars or arrays as input in units given by ~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units. Returns ~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim scalars or arrays. Note that pixel coordinates are assumed to be 0 at the center of the first pixel in each dimension. If a world coordinate does not have a matching pixel coordinate, NaN can be returned. The coordinates should be returned in the (x, y) order, where for an image, x is the horizontal coordinate and y is the vertical coordinate.

If ~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim is 1, this method returns a single scalar or array, otherwise a tuple of scalars or arrays is returned.