paste#

arte.utils.paste.paste(wall, block, loc)#

Paste block array into wall in location loc.

loc must be a tuple (even if block.ndim=1) Going outside of the edges of wall is properly managed. wall is modified in place.

Parameters:
  • wall (array of ndim=N) – Array in which block is pasted.

  • block (array of ndim=N) – Array to be pasted into wall

  • loc (tuple, shape (N,)) – location where to paste block.

Return type:

None

Example

Insert array [1,2,3,4] into an empty array of size 10 at location 8

>>> b = np.zeros([10])
>>> a = np.arange(1, 5)
>>> b
array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])
>>> a
array([1, 2, 3, 4])
>>> paste(b, a, (8,))
>>> b
array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  2.])

References

https://stackoverflow.com/questions/7115437/how-to-embed-a-small-numpy-array-into-a-predefined-block-of-a-large-numpy-arra