get_crop_item_from_points#

ndcube.utils.cube.get_crop_item_from_points(points, wcs, crop_by_values)[source]#

Find slice item that crops to minimum cube in array-space containing specified world points.

Parameters:
  • points (iterable of iterables) – Each iterable represents a point in real world space. Each element in a point gives the real world coordinate value of the point in high-level coordinate objects or quantities. (Must be consistently high or low level within and across points.) Objects must be in the order required by wcs.world_to_array_index/world_to_array_index_values.

  • wcs (BaseHighLevelWCS, BaseLowLevelWCS) – The WCS to use to convert the world coordinates to array indices.

  • crop_by_values (bool) – Denotes whether cropping is done using high-level objects or “values”, i.e. low-level objects.

Returns:

item (tuple of slice) – The slice item for each axis of the cube which, when applied to the cube, will return the minimum cube in array-index-space that contains all the input world points.