Skip to main content
`Ctrl`+`K`

# get_crop_item_from_points

ndcube.utils.cube.get_crop_item_from_points(points, wcs, crop_by_values, keepdims, original_shape)

  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.

    - keepdims (`bool`) – If `False`, returned item will drop length-1 dimensions otherwise, item will keep length-1 dimensions.

    - original_shape (`tuple` of `int`) – The shape of the data cube before cropping.

  Returns:

    item – 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.

  Return type:

    `tuple` of `slice`