# Coordinates¶

class glue.core.coordinates.Coordinates[source]

Bases: object

Base class for coordinate transformation

Methods Summary

 axis_label(axis) dependent_axes(axis) Return a tuple of which world-axes are non-indepndent pixel2world(*args) Convert pixel to world coordinates, preserving input type/shape. pixel2world_single_axis(*pixel, **kwargs) Convert pixel to world coordinates, preserving input type/shape. world2pixel(*args) Convert world to pixel coordinates, preserving input type/shape. world2pixel_single_axis(*world, **kwargs) Convert world to pixel coordinates, preserving input type/shape. world_axis(data, axis) Find the world coordinates along a given dimension, and which for now we center on the pixel origin. world_axis_unit(axis) Return the unit of the world coordinate given by axis (assuming the

Methods Documentation

axis_label(axis)[source]
dependent_axes(axis)[source]

Return a tuple of which world-axes are non-indepndent from a given pixel axis

The axis index is given in numpy ordering convention (note that opposite the fits convention)

pixel2world(*args)[source]

Convert pixel to world coordinates, preserving input type/shape.

Parameters: *pixel : scalars lists, or Numpy arrays The pixel coordinates (0-based) to convert *world : Numpy arrays The corresponding world coordinates
pixel2world_single_axis(*pixel, **kwargs)[source]

Convert pixel to world coordinates, preserving input type/shape.

This is a wrapper around pixel2world which returns the result for just one axis, and also determines whether the calculation can be sped up if broadcasting is present in the input arrays.

Parameters: *pixel : scalars lists, or Numpy arrays The pixel coordinates (0-based) to convert axis : int, optional If only one axis is needed, it should be specified since the calculation will be much more efficient. world : numpy.ndarray The world coordinates for the requested axis
world2pixel(*args)[source]

Convert world to pixel coordinates, preserving input type/shape.

Parameters: *world : scalars lists, or Numpy arrays The world coordinates to convert *pixel : Numpy arrays The corresponding pixel coordinates
world2pixel_single_axis(*world, **kwargs)[source]

Convert world to pixel coordinates, preserving input type/shape.

This is a wrapper around world2pixel which returns the result for just one axis, and also determines whether the calculation can be sped up if broadcasting is present in the input arrays.

Parameters: *world : scalars lists, or Numpy arrays The world coordinates to convert axis : int, optional If only one axis is needed, it should be specified since the calculation will be much more efficient. pixel : numpy.ndarray The pixel coordinates for the requested axis
world_axis(data, axis)[source]

Find the world coordinates along a given dimension, and which for now we center on the pixel origin.

Parameters: data : ~glue.core.data.Data The data to compute the coordinate axis for (this is used to determine the size of the axis) axis : int The axis to compute, in Numpy axis order

Notes

This method computes the axis values using pixel positions at the center of the data along all other axes. This will therefore only give the correct result for non-dependent axes (which can be checked using the dependent_axes method).

world_axis_unit(axis)[source]

Return the unit of the world coordinate given by axis (assuming the Numpy axis order)