gwcs.wcstools.grid_from_bounding_box¶
- gwcs.wcstools.grid_from_bounding_box(bounding_box, step=1, center=True, selector=None)¶
Create a grid of input points from the WCS bounding_box.
- Note: If
bboxis a tuple describing the range of an axis inbounding_box, x.5is considered part of the next pixel inbbox[0]and part of the previous pixel inbbox[1]. In this way ifbboxdescribes the edges of an image the indexing includes only pixels within the image.
The bounding_box is in order of X, Y [, Z] and the output will be in the same order.
- Parameters:
bounding_box (tuple | ModelBoundingBox | CompoundBoundingBox) – The bounding_box of a WCS object,
bounding_box.step (scalar or tuple) – Step size for grid in each dimension. Scalar applies to all dimensions.
center (bool) – If
Trueuse the center of the pixel, otherwise use the corner.selector (tuple | None) – If selector is set then it must be a selector tuple and bounding_box must be a CompoundBoundingBox.
Examples
>>> bb = ((-1, 2.9), (6, 7.5)) >>> grid_from_bounding_box(bb, step=(1, .5), center=False) array([[[-1. , 0. , 1. , 2. , 3. ], [-1. , 0. , 1. , 2. , 3. ], [-1. , 0. , 1. , 2. , 3. ], [-1. , 0. , 1. , 2. , 3. ]], [[ 6. , 6. , 6. , 6. , 6. ], [ 6.5, 6.5, 6.5, 6.5, 6.5], [ 7. , 7. , 7. , 7. , 7. ], [ 7.5, 7.5, 7.5, 7.5, 7.5]]])
>>> bb = ((-1, 2.9), (6, 7.5)) >>> grid_from_bounding_box(bb) array([[[-1., 0., 1., 2., 3.], [-1., 0., 1., 2., 3.]], [[ 6., 6., 6., 6., 6.], [ 7., 7., 7., 7., 7.]]])
- Returns:
x, y [, z] – Grid of points.
- Return type:
ndarray
- Note: If