In Matlab, there is the command repelem which works as follows (see https://www.mathworks.com/help/matlab/ref/repelem.html#buocbhj-2):
e.g.: Create a matrix and repeat each element into a 3-by-2 block of a new matrix.
A = [1 2; 3 4]
B = repelem(A,3,2)
A = (2×2)
1 2
3 4
B = (6×4)
1 1 2 2
1 1 2 2
1 1 2 2
3 3 4 4
3 3 4 4
3 3 4 4
What is the best way to do the same in Numpy?
A = np.arange(1,5).reshape((2,2))
B = ...