grid_from_bounding_box¶
-
gwcs.wcstools.
grid_from_bounding_box
(bounding_box, step=1, center=True)[source]¶ Create a grid of input points from the WCS bounding_box.
- Note: If
bbox
is a tuple describing the range of an axis inbounding_box
, x.5
is considered part of the next pixel inbbox[0]
and part of the previous pixel inbbox[1]
. In this way ifbbox
describes the edges of an image the indexing includes only pixels within the image.
Parameters: - bounding_box : tuple
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
- The bounding_box is in order of X, Y [, Z] and the output will be in the
- same order.
Returns: - x, y [, z]: ndarray
Grid of points.
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.]]])
- Note: If