Modified python script to only populate upper triangle of matrix.