Проще с дополнительным измерением в начале:
In [376]: C = np.zeros((4,2,3),int)
In [377]: s = np.array([[0,0],[0,1],[1,0],[1,1]],bool)
In [378]: d = np.arange(1,13).reshape(4,3)
In [379]: C.shape, s.shape, d.shape
Out[379]: ((4, 2, 3), (4, 2), (4, 3))
In [380]: I,J = np.nonzero(s)
In [381]: I,J
Out[381]: (array([1, 2, 3, 3]), array([1, 0, 0, 1]))
In [383]: C[I,J]=d[I]
In [384]: C
Out[384]:
array([[[ 0, 0, 0],
[ 0, 0, 0]],
[[ 0, 0, 0],
[ 4, 5, 6]],
[[ 7, 8, 9],
[ 0, 0, 0]],
[[10, 11, 12],
[10, 11, 12]]])
Ваш путь:
In [385]: C = np.zeros((4,2,3),int)
In [386]: for i in range(4):
...: C[i,:,:][s[i,:]] += d[i,:]
...:
In [387]: C
Out[387]:
array([[[ 0, 0, 0],
[ 0, 0, 0]],
[[ 0, 0, 0],
[ 4, 5, 6]],
[[ 7, 8, 9],
[ 0, 0, 0]],
[[10, 11, 12],
[10, 11, 12]]])