ResampledLowLevelWCS#

class ndcube.wcs.wrappers.ResampledLowLevelWCS(wcs, factor, offset=0)[source]#

Bases: BaseWCSWrapper

A wrapper for a low-level WCS object that has down- or up-sampled pixel axes.

Parameters:
  • wcs (BaseLowLevelWCS) – The original WCS for which to reorder axes

  • factor (int or float or iterable of the same) – The factor by which to increase the pixel size for each pixel axis. If a scalar, the same factor is used for all axes.

  • offset (int or float or iterable of the same) – The location on the underlying pixel grid which corresponds to zero on the top level pixel grid. If a scalar, the grid will be shifted by the same amount in all dimensions.

Attributes Summary

pixel_bounds

The bounds (in pixel coordinates) inside which the WCS is defined, as a list with pixel_n_dim (min, max) tuples.

pixel_shape

The shape of the data that the WCS applies to as a tuple of length pixel_n_dim in (x, y) order (where for an image, x is the horizontal coordinate and y is the vertical coordinate).

Methods Summary

pixel_to_world_values(*pixel_arrays)

Convert pixel coordinates to world coordinates.

world_to_pixel_values(*world_arrays)

Convert world coordinates to pixel coordinates.

Attributes Documentation

pixel_bounds#
pixel_shape#

Methods Documentation

pixel_to_world_values(*pixel_arrays)[source]#

Convert pixel coordinates to world coordinates.

This method takes pixel_n_dim scalars or arrays as input, and pixel coordinates should be zero-based. Returns world_n_dim scalars or arrays in units given by 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 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_arrays)[source]#

Convert world coordinates to pixel coordinates.

This method takes world_n_dim scalars or arrays as input in units given by world_axis_units. Returns 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 pixel_n_dim is 1, this method returns a single scalar or array, otherwise a tuple of scalars or arrays is returned.