arrlp.coordinates module

arrlp.coordinates(shape, pixel=1.0, *, ndims=1, center=True, grid=False, origin=0.0, cuda=False)[source]

This function will return a ndarray corresponding to the coordinates array of the input.

Parameters:
  • shape (int or tuple or np.ndarray) – Describes the shape of the coordinates. If int, all dimensions will have this value. If tuple, corresponds to the shape.

  • pixel (float, tuple(float)) – Says what is the size of one bin, default is 1. If tuple, corresponds to the pixel for each dimension.

  • ndims (int) – Number of dimensions if input shape is int. Will be overriden by any other input dimension.

  • center (bool or tuple(bool)) – True to center origin, False to start by origin. If tuple, defines how to place origin for each dimension.

  • grid (bool) – True to return full meshgrid for each dimensions, False for broadcastable arrays.

  • origin (float or tuple(float)) – Value of origin (default 0). If tuple, value for each dimension.

  • cuda (bool) – True to apply cuda.

Returns:

coords – return a tuple of arrays for each dimensions.

Return type:

tuple(np.ndarray)

Raises:

ValueError – if input or passed as tuples that do not have the good number of dimensions.

Examples

>>> from arrlp import coordinates
...
>>> array = np.ones((5,4))
>>> coordinates = coordinates(array, pixel=10, center=(True, False), grid=False, origin=(0,3))
... array([[-20.], [-10.], [0.], [10.], [20.]]), array([[3., 13., 23., 33.]])