view scripts/utils.py @ 27:1a88766113a9

A lot of things. Fixed problem in Gap Fixed multiprocessor versions of script (both PP and multiproc)
author nikcleju
date Wed, 09 Nov 2011 18:18:42 +0000
parents
children e8c4672e9de4
line wrap: on
line source
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 09 12:28:55 2011

@author: ncleju
"""

import scipy.io
import matplotlib.pyplot as plt
import matplotlib.cm as cm

def loadshowmatrices(filename, algostr = ('GAP','SL0_approx')):
    mdict = scipy.io.loadmat(filename)
    for strname in algostr:
        print strname
        if mdict['meanmatrix'][strname][0,0].ndim == 2:
            plt.figure()
            plt.imshow(mdict['meanmatrix'][strname][0,0], cmap=cm.gray, interpolation='nearest',origin='lower')            
        elif mdict['meanmatrix'][strname][0,0].ndim == 3:
            for matrix in mdict['meanmatrix'][strname][0,0]:
                plt.figure()
                plt.imshow(matrix, cmap=cm.gray, interpolation='nearest',origin='lower')
    plt.show()
    print "Finished."