Extract smaller array of given shape and position out of a larger array.
Parameters: | array_large : ndarray
shape : tuple
position : tuple
|
---|---|
Returns: | array_small : ndarray
|
Examples
We consider a large array with the shape 11x10, from which we extract a small array of shape 3x5:
>>> import numpy as np
>>> from astropy.nddata.utils import extract_array
>>> large_array = np.arange(110).reshape((11, 10))
>>> large_array[4:9, 4:9] = np.ones((5, 5))
>>> extract_array(large_array, (3, 5), (7, 7))
array([[ 1, 1, 1, 1, 69],
[ 1, 1, 1, 1, 79],
[ 1, 1, 1, 1, 89]])