colors = {} for i in xrange(len(ffs)): colors[ffs[i]] = all_colors[i] sleeptime = 30*60 # 30 minutes for frame in xrange(100000): plt.cla() for ff in ffs: basename = 'data/lv/ww%.2f-ff%.2f-%gx%g' % (ww,ff,lenx,lenyz) e, diff = readandcompute.e_diffusion_estimate(basename) N = readandcompute.read_N(basename); try: ax.axvline(-readandcompute.max_entropy_state(basename)/N, color=colors[ff], linestyle=':') ax.axvline(-readandcompute.min_important_energy(basename)/N, color=colors[ff], linestyle=':') T, u, cv, s, minT = readandcompute.T_u_cv_s_minT(basename) ax.plot(u/N, T, 'k-') ax.set_ylim(0, 3) ax.axhline(minT, color='r', linestyle=':') e, hist = readandcompute.e_hist(basename) iterations = readandcompute.iterations(basename) ax.plot(e/N, 2.5*hist/hist.max(), colors[ff]+'-', label=r'$\eta = %g$, %e iterations' % (ff, iterations)) except: pass e, init_hist = readandcompute.e_and_total_init_histogram(basename) ax.plot(e, 2.5*init_hist/init_hist.max(), colors[ff]+'--', label=r'$\eta = %g$, %e initialization iterations' % (ff, sum(init_hist)))
for frame in xrange(numframes): if frame % 10 == 0: print 'working on frame %d/%d' % (frame, numframes) plt.cla() for suffix_index in range(len(suffixes)): suffix = suffixes[suffix_index] basename = dataformat % (suffix, frame*skipby) try: e, hist = readandcompute.e_and_total_init_histogram(basename) ax.plot(e, hist, colors[suffix_index]+'-', label=suffix) datname = basename+'-transitions.dat' min_T = readandcompute.minT(datname) ax.axvline(-readandcompute.max_entropy_state(basename), color='r', linestyle=':') min_important_energy = readandcompute.min_important_energy(basename) ax.axvline(-min_important_energy, color='b', linestyle=':') ax.axvline(-readandcompute.converged_state(datname), color=colors[suffix_index], linestyle=':') except (KeyboardInterrupt, SystemExit): raise except: pass ax.set_xlabel(r'$E$') ax.set_ylim(0, maxhist) # ax.set_xlim(-5, -0.3) ax.set_xlim(mine, maxe) ax.set_ylabel(r'histogram') # ax.legend(loc='best').get_frame().set_alpha(0.25) plt.title(r'lv movie from %s ($T_{min} = %g$)' % (filename, min_T)) plt.legend(loc='best')
min_T = None for frame in xrange(numframes): if frame % 10 == 0: print 'working on frame %d/%d' % (frame, numframes) plt.cla() basename = dataformat % frame old_min_T = min_T min_T = readandcompute.minT_from_transitions(basename) # e, diff = readandcompute.e_diffusion_estimate(basename) try: N = readandcompute.read_N(basename) ax.axvline(-readandcompute.max_entropy_state(basename), color='r', linestyle=':') ax.axvline(-readandcompute.min_important_energy(basename), color='b', linestyle=':') ax.axvline(-readandcompute.converged_state(basename+'-lndos.dat'), color='c', linestyle=':') except: pass e, init_hist = readandcompute.e_and_total_init_histogram(basename) if min_T != old_min_T: print 'min_T goes from', old_min_T, 'to', min_T baseline_init_hist = init_hist baseline_e = e ax.plot(e, init_hist, 'b-', label=r'%e initialization iterations' % (sum(init_hist)/float(N))) # newstuff below is init_hist - baseline_init_hist, but takes into # account the fact that these arrays might not be the same size. # So we look up the element with the corresponding energy. if len(e) != len(baseline_e):
#arg ffs = [[0.1,0.2,0.3]] lenx = float(sys.argv[3]) #arg lenx = [50,100] lenyz = float(sys.argv[4]) #arg lenyz = [10] fig, axD = plt.subplots() axT = plt.twinx() for ff in ffs: basename = 'data/lv/ww%.2f-ff%.2f-%gx%g' % (ww,ff,lenx,lenyz) e, diff = readandcompute.e_diffusion_estimate(basename) N = readandcompute.read_N(basename); axD.plot(e, diff, label=r'$\eta = %g$' % ff) axD.axvline(-readandcompute.max_entropy_state(basename)/N, linestyle=':') axD.axvline(-readandcompute.min_important_energy(basename)/N, linestyle='--') T, u, cv, s, minT = readandcompute.T_u_cv_s_minT(basename) axT.plot(u/N, T, 'r-') axT.set_ylim(0, 3) axT.axhline(minT, color='r', linestyle=':') e, hist = readandcompute.e_hist(basename) axT.plot(e/N, 2.5*hist/hist.max(), 'k:') e, init_hist = readandcompute.e_and_total_init_histogram(basename) for i in xrange(len(e)): print e[i], (2.5*init_hist/init_hist.max())[i] axT.plot(e, 2.5*init_hist/init_hist.max(), 'c--') axT.spines['right'].set_color('red')
for frame in range(1000000): assert not os.system(cmd) total_iterations += iterations_per_frame plt.cla() basename = datadir+'/ww%.2f-ff%.2f-N%d' % (ww, ff, N) e, diff = readandcompute.e_diffusion_estimate(basename) T, u, cv, s, minT = readandcompute.T_u_cv_s_minT(basename) ax.plot(u/N, T, 'k-') ax.set_ylim(0, 3) ax.axhline(minT, color='r', linestyle=':') ax.axvline(-readandcompute.max_entropy_state(basename)/N, color='r', linestyle=':') ax.axvline(-readandcompute.min_important_energy(basename)/N, color='r', linestyle='--') e, init_hist = readandcompute.e_and_total_init_histogram(basename) ax.plot(e, init_hist, 'k-') ax.set_xlabel(r'$E/N$') ax.set_ylim(0, init_hist.max()*1.1) ax.set_ylabel(r'$N$') plt.title(r'Initialization histogram with $\lambda = %g$, $\eta = %g$, and $N = %d$ (%.0fM iters)' % (ww, ff, N, total_iterations/1.0e6)) fname = moviedir+'/frame%06d.png' % (frame) print('saving', fname) plt.savefig(fname) os.system("convert -delay 100 %s/frame*.png %s/movie.gif"
for suffix_index in range(len(suffixes)): suffix = suffixes[suffix_index] basename = dataformat % (suffix, frame * skipby) try: e, lndos, lndostm = readandcompute.e_lndos_lndostm(basename) colors.plot(e, lndos, method=suffix) if lndostm is not None and suffix[:2] != 'sa': colors.plot(e, lndostm, method=suffix + '-tm') datname = basename + '-lndos.dat' min_T = readandcompute.minT(datname) ax.axvline(-readandcompute.max_entropy_state(datname), color='r', linestyle=':') min_important_energy = int( readandcompute.min_important_energy(datname)) ax.axvline(-min_important_energy, color='b', linestyle=':') # Uncomment the following to plot a line at the # min_important_energy with slope determined by min_T # ax.plot(e, (e+min_important_energy)/min_T + lndos[min_important_energy], colors[suffix_index]+'--') # ax.axvline(-readandcompute.converged_state(datname), color=colors.color(suffix), linestyle=':') # Uncomment the following to plot the lnw along with the lndos # e, lnw = readandcompute.e_lnw(basename) # ax.plot(e, -lnw, colors[suffix_index]+':') except (KeyboardInterrupt, SystemExit): raise except Exception as e: print(e) pass ax.set_xlabel(r'$E$')
#arg ffs = [[0.1,0.2,0.3]] lenx = float(sys.argv[3]) #arg lenx = [50,100] lenyz = float(sys.argv[4]) #arg lenyz = [10] fig, axD = plt.subplots() axT = plt.twinx() for ff in ffs: basename = 'data/lv/ww%.2f-ff%.2f-%gx%g' % (ww, ff, lenx, lenyz) e, diff = readandcompute.e_diffusion_estimate(basename) N = readandcompute.read_N(basename) axD.plot(e, diff, label=r'$\eta = %g$' % ff) axD.axvline(-readandcompute.max_entropy_state(basename) / N, linestyle=':') axD.axvline(-readandcompute.min_important_energy(basename) / N, linestyle='--') T, u, cv, s, minT = readandcompute.T_u_cv_s_minT(basename) axT.plot(u / N, T, 'r-') axT.set_ylim(0, 3) axT.axhline(minT, color='r', linestyle=':') e, hist = readandcompute.e_hist(basename) axT.plot(e / N, 2.5 * hist / hist.max(), 'k:') e, init_hist = readandcompute.e_and_total_init_histogram(basename) for i in xrange(len(e)): print e[i], (2.5 * init_hist / init_hist.max())[i] axT.plot(e, 2.5 * init_hist / init_hist.max(), 'c--')
print 'numframes', numframes for frame in xrange(numframes): if frame % 10 == 0: print 'working on frame %d/%d' % (frame, numframes) plt.cla() basename = dataformat % frame e, lndos = readandcompute.e_lndos(basename) ax.plot(e, lndos, 'k-') datname = basename+'-lndos.dat' min_T = readandcompute.minT(datname) try: ax.axvline(-readandcompute.max_entropy_state(basename), color='r', linestyle=':') min_important_energy = readandcompute.min_important_energy(basename) ax.axvline(-min_important_energy, color='b', linestyle=':') ax.plot(e, (e+min_important_energy)/min_T + lndos[min_important_energy], 'g--') ax.axvline(-readandcompute.converged_state(datname), color='c', linestyle=':') except: pass e, lnw = readandcompute.e_lnw(basename) ax.plot(e, -lnw, 'r:') ax.set_xlabel(r'$E$') ax.set_ylim(1.1*minlndos, maxlndos) # ax.set_xlim(-5, -0.3) ax.set_xlim(mine, maxe) ax.set_ylabel(r'$\ln DOS$') # ax.legend(loc='best').get_frame().set_alpha(0.25) if 'tmi' in sys.argv:
plt.cla() ax.plot(best_e, best_lndos, ':', color='0.5') for suffix_index in range(len(suffixes)): suffix = suffixes[suffix_index] basename = dataformat % (suffix, frame*skipby) try: e, lndos, lndostm = readandcompute.e_lndos_lndostm(basename) colors.plot(e, lndos, method=suffix) if lndostm is not None and suffix[:2] != 'sa': colors.plot(e, lndostm, method=suffix+'-tm') datname = basename+'-lndos.dat' min_T = readandcompute.minT(datname) ax.axvline(-readandcompute.max_entropy_state(datname), color='r', linestyle=':') min_important_energy = int(readandcompute.min_important_energy(datname)) ax.axvline(-min_important_energy, color='b', linestyle=':') # Uncomment the following to plot a line at the # min_important_energy with slope determined by min_T # ax.plot(e, (e+min_important_energy)/min_T + lndos[min_important_energy], colors[suffix_index]+'--') # ax.axvline(-readandcompute.converged_state(datname), color=colors.color(suffix), linestyle=':') # Uncomment the following to plot the lnw along with the lndos # e, lnw = readandcompute.e_lnw(basename) # ax.plot(e, -lnw, colors[suffix_index]+':') except (KeyboardInterrupt, SystemExit): raise except Exception as e: print(e) pass ax.set_xlabel(r'$E$')