I need to test a boolean in an array, and based on the answer, apply an elementwise operation on a matrix. I seem to be getting the boolean answer for the ROW and not for the individual element itself. how do i test and get the answer for each individual element?
i have an matrix of probabilities
probs = np.array([[0.1, 0.2, 0.3, 0.3, 0.7],
                  [0.1, 0.2, 0.3, 0.3, 0.7],
                  [0.7, 0.2, 0.6, 0.1, 0.0]])
and a matrix of test arrays
tst = ([False, False, True, True, False],
       [True, False, True, False, False],
       )
t = np.asarray(tst).astype('bool')
and this segment of code i have written which outputs the answer, but obviously test the entire row, as everything is FALSE.
for row in tst:
    mat = []
    for row1 in probs:
        temp = []
        if row == True:
            temp.append(row1)
        else: temp.append(row1-1)
        mat.append(temp)
mat
Out[42]: 
[[array([-0.9, -0.8, -0.7, -0.7, -0.3])],
 [array([-0.9, -0.8, -0.7, -0.7, -0.3])],
 [array([-0.3, -0.8, -0.4, -0.9, -1. ])]]
i need the new matrix to be
[[-0.9, -0.8, 0.3, 0.3, -0.3],
 [-0.9, -0.8, 0.3, 0.3, -0.3],
 [-0.3, -0.8, 0.6, 0.1, -1]
for the 1st array in tst. Thanks very much for any assistance!
 
     
     
    