Coordinates¶
-
class
glue.core.coordinates.
Coordinates
[source]¶ Bases:
object
Base class for coordinate transformation
Methods Summary
axis_label
(self, axis)default_world_coords
(self, ndim)dependent_axes
(self, axis)Return a tuple of which world-axes are non-independent from a given pixel axis
pixel2world
(self, \*args)Convert pixel to world coordinates, preserving input type/shape.
pixel2world_single_axis
(self, \*pixel, …)Convert pixel to world coordinates, preserving input type/shape.
world2pixel
(self, \*args)Convert world to pixel coordinates, preserving input type/shape.
world2pixel_single_axis
(self, \*world, …)Convert world to pixel coordinates, preserving input type/shape.
world_axis
(self, data, axis)Find the world coordinates along a given dimension, and which for now we center on the pixel origin.
world_axis_unit
(self, axis)Return the unit of the world coordinate given by
axis
(assuming the Numpy axis order)Methods Documentation
-
dependent_axes
(self, axis)[source]¶ Return a tuple of which world-axes are non-independent from a given pixel axis
The axis index is given in numpy ordering convention (note that opposite the fits convention)
-
pixel2world
(self, *args)[source]¶ Convert pixel to world coordinates, preserving input type/shape.
- Parameters
- *pixelscalars lists, or Numpy arrays
The pixel coordinates (0-based) to convert
- Returns
- *worldNumpy arrays
The corresponding world coordinates
-
pixel2world_single_axis
(self, *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
- *pixelscalars lists, or Numpy arrays
The pixel coordinates (0-based) to convert
- axisint, optional
If only one axis is needed, it should be specified since the calculation will be much more efficient.
- Returns
- worldnumpy.ndarray
The world coordinates for the requested axis
-
world2pixel
(self, *args)[source]¶ Convert world to pixel coordinates, preserving input type/shape.
- Parameters
- *worldscalars lists, or Numpy arrays
The world coordinates to convert
- Returns
- *pixelNumpy arrays
The corresponding pixel coordinates
-
world2pixel_single_axis
(self, *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
- *worldscalars lists, or Numpy arrays
The world coordinates to convert
- axisint, optional
If only one axis is needed, it should be specified since the calculation will be much more efficient.
- Returns
- pixelnumpy.ndarray
The pixel coordinates for the requested axis
-
world_axis
(self, 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)
- axisint
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).
-