Changeset 476 for mystic/scripts
- Timestamp:
- 08/29/11 14:54:25 (5 years ago)
- Location:
- mystic/scripts
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/scripts/mystic_log_reader.py
r475 r476 19 19 parser.add_option("-i","--iter",action="store",dest="stop",metavar="INT",\ 20 20 default=None,help="the largest iteration to plot") 21 parser.add_option("-g","--legend",action="store_true",dest="legend",\ 22 default=False,help="show the legend") 21 23 #parser.add_option("-f","--file",action="store",dest="filename",metavar="FILE",\ 22 24 # default='log.txt',help="log file name") … … 43 45 stop = None 44 46 45 f = open(filename,"r")46 file = f.read()47 f.close()48 49 contents = file.split("\n")50 51 47 # == Possible results == 52 48 # iter = (i,id) or (i,) … … 68 64 69 65 # parse file contents to get (i,id), cost, and parameters 70 step = []; cost = []; param = []; 71 for line in contents[:-1]: 72 if line.startswith("#"): pass 73 else: 74 values = line.split(" ") 75 step.append(eval(values[0])) #XXX: yields (i,id) 76 cost.append(eval(values[1])) 77 param.append(eval(values[2])) 66 from mystic.munge import logfile_reader 67 step, param, cost = logfile_reader(filename) 78 68 79 69 # ignore everything after 'stop' … … 125 115 tag = "%d,%d" % (i,j) 126 116 ax1.plot(iter_conv[i],conv[i][j],label="%s" % tag,marker=mark,linestyle=style) 127 plt.legend()117 if parsed_opts.legend: plt.legend() 128 118 129 119 ax2 = fig.add_subplot(2,1,2) … … 131 121 tag = "%d" % i 132 122 ax2.plot(iter_conv[i],cost_conv[i],label='cost %s' % tag,marker=mark,linestyle=style) 133 plt.legend()123 if parsed_opts.legend: plt.legend() 134 124 135 125 plt.show() -
mystic/scripts/support_convergence.py
r475 r476 61 61 parser.add_option("-c","--cost",action="store_true",dest="cost",\ 62 62 default=False,help="also plot the parameter cost") 63 parser.add_option("- l","--legend",action="store_true",dest="legend",\63 parser.add_option("-g","--legend",action="store_true",dest="legend",\ 64 64 default=False,help="show the legend") 65 65 parsed_opts, parsed_args = parser.parse_args() … … 71 71 except: 72 72 raise IOError, "please provide log file name" 73 #file = 'paramlog' 74 exec "from %s import params" % file 73 try: # read standard logfile 74 from mystic.munge import logfile_reader, raw_to_support 75 _step, params, cost = logfile_reader(file) 76 params, cost = raw_to_support(params, cost) 77 except: 78 exec "from %s import params" % file 79 exec "from %s import cost" % file 75 80 76 81 if parsed_opts.cost: # also plot the cost 77 exec "from %s import cost" % file 82 #exec "from %s import cost" % file 83 pass 78 84 else: 79 85 cost = None -
mystic/scripts/support_hypercube.py
r475 r476 52 52 except: 53 53 raise IOError, "please provide log file name" 54 #file = 'paramlog' 55 exec "from %s import params" % file 56 #exec "from %s import meta" % file 57 # would be nice to use meta = ['wx','wx2','x','x2','wy',...] 54 try: # read standard logfile 55 from mystic.munge import logfile_reader, raw_to_support 56 _step, params, _cost = logfile_reader(file) 57 params, _cost = raw_to_support(params, _cost) 58 except: 59 exec "from %s import params" % file 60 #exec "from %s import meta" % file 61 # would be nice to use meta = ['wx','wx2','x','x2','wy',...] 58 62 59 63 try: # select the bounds -
mystic/scripts/support_hypercube_measures.py
r475 r476 58 58 except: 59 59 raise IOError, "please provide log file name" 60 #file = 'paramlog' 61 exec "from %s import params" % file 62 #exec "from %s import meta" % file 63 # would be nice to use meta = ['wx','wx2','x','x2','wy',...] 60 try: # read standard logfile 61 from mystic.munge import logfile_reader, raw_to_support 62 _step, params, _cost = logfile_reader(file) 63 params, _cost = raw_to_support(params, _cost) 64 except: 65 exec "from %s import params" % file 66 #exec "from %s import meta" % file 67 # would be nice to use meta = ['wx','wx2','x','x2','wy',...] 64 68 65 69 try: # select the bounds
Note: See TracChangeset
for help on using the changeset viewer.