Skip to main content
`Ctrl`+`K`

# array_indices_for_world_objects

ndcube.utils.wcs.array_indices_for_world_objects(wcs, axes=None)

  Calculate the array indices corresponding to each high level world object.

  This function is to assist in comparing the return values from `NDCube.axis_world_coords` or `world_to_pixel`. It returns a tuple of the same length as the output from those methods with each element being the array indices corresponding to those objects.

  Parameters:

    - wcs (`astropy.wcs.wcsapi.BaseHighLevelWCS`) – The wcs object used to calculate world coordinates.

    - axes (iterable of `int` or `str`) – Axis number in numpy ordering or unique substring of `wcs.world_axis_physical_types` of axes for which real world coordinates are desired. axes=None implies all axes will be returned.

  Returns:

    array_indices – For each world object, a tuple of array axes identified by their number. Array indices in each sub-tuple are not guaranteed to be ordered with respect to the arrays in the object, as the object could be an object like `SkyCoord` where there is a separation of the two coordinates. The array indices will be returned in the sub-tuple in array index order, i.e ascending.

  Return type:

    `tuple` of `tuple` of `int`