Add a smaller array at a given position in a larger array.
Parameters: | array_large : ndarray
array_small : ndarray
position : tuple
|
---|---|
Returns: | new_array : ndarray
|
Notes
The addition is done in-place.
Examples
We consider a large array of zeros with the shape 5x5 and a small array of ones with a shape of 3x3:
>>> import numpy as np
>>> from astropy.nddata.utils import add_array
>>> large_array = np.zeros((5, 5))
>>> small_array = np.ones((3, 3))
>>> add_array(large_array, small_array, (1, 2))
array([[ 0., 1., 1., 1., 0.],
[ 0., 1., 1., 1., 0.],
[ 0., 1., 1., 1., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.]])