Solved by tom in post #3 
              
              
                I used numpy’s triu_indices to set things to 0 above the diagonal (see below). An alternative can be you could also use a mask. 


Best regards 
Thomas