comparison scripts/ABSapprox.py @ 34:e8c4672e9de4

Save algonames (not tested) in output mat file Matplotlib saves tight images (bbox_inches = 'tight') utils.py: added loadsavematrices, modified loadshowmatrices
author nikcleju
date Tue, 15 Nov 2011 14:50:58 +0000
parents 116dcfacd1cc
children d4f9c906dc78
comparison
equal deleted inserted replaced
33:116dcfacd1cc 34:e8c4672e9de4
305 tosave['deltas'] = deltas 305 tosave['deltas'] = deltas
306 tosave['rhos'] = rhos 306 tosave['rhos'] = rhos
307 tosave['numvects'] = numvects 307 tosave['numvects'] = numvects
308 tosave['SNRdb'] = SNRdb 308 tosave['SNRdb'] = SNRdb
309 tosave['lambdas'] = lambdas 309 tosave['lambdas'] = lambdas
310 tosave['algonames'] = [algotuple[1] for algotuple in algosN+algosL]
310 try: 311 try:
311 scipy.io.savemat(savedataname, tosave) 312 scipy.io.savemat(savedataname, tosave)
312 except: 313 except:
313 print "Save error" 314 print "Save error"
314 # Show 315 # Show
317 algoname = algotuple[1] 318 algoname = algotuple[1]
318 plt.figure() 319 plt.figure()
319 plt.imshow(meanmatrix[algoname], cmap=cm.gray, interpolation='nearest',origin='lower') 320 plt.imshow(meanmatrix[algoname], cmap=cm.gray, interpolation='nearest',origin='lower')
320 if dosaveplot: 321 if dosaveplot:
321 for ext in saveplotexts: 322 for ext in saveplotexts:
322 plt.savefig(saveplotbase + algoname + '.' + ext) 323 plt.savefig(saveplotbase + algoname + '.' + ext, bbox_inches='tight')
323 for algotuple in algosL: 324 for algotuple in algosL:
324 algoname = algotuple[1] 325 algoname = algotuple[1]
325 for ilbd in np.arange(lambdas.size): 326 for ilbd in np.arange(lambdas.size):
326 plt.figure() 327 plt.figure()
327 plt.imshow(meanmatrix[algoname][ilbd], cmap=cm.gray, interpolation='nearest',origin='lower') 328 plt.imshow(meanmatrix[algoname][ilbd], cmap=cm.gray, interpolation='nearest',origin='lower')
328 if dosaveplot: 329 if dosaveplot:
329 for ext in saveplotexts: 330 for ext in saveplotexts:
330 plt.savefig(saveplotbase + algoname + ('_lbd%.0e' % lambdas[ilbd]) + '.' + ext) 331 plt.savefig(saveplotbase + algoname + ('_lbd%.0e' % lambdas[ilbd]) + '.' + ext, bbox_inches='tight')
331 if doshowplot: 332 if doshowplot:
332 plt.show() 333 plt.show()
333 334
334 print "Finished." 335 print "Finished."
335 336