plt.figure(figsize=(5, 4)) inputs = [ #('vanilla_wang_landau', # 'data/s000/periodic-ww1.30-ff0.30-N500-vanilla_wang_landau-minE-movie/002000-lndos.dat'), ('samc-1e+06', 'data/s000/periodic-ww1.50-ff0.17-N256-samc-100000-movie/000600-lndos.dat' ), #('sad3', 'data/s000/periodic-ww1.30-ff0.30-N500-sad3-movie/002000-lndos.dat'), #('sad3-test', 'data/s000/periodic-ww1.30-ff0.30-N500-sad3-test-movie/002000-lndos.dat') ] for method, fname in inputs: print('plotting', method) e, lndos = readnew.e_lndos(fname) colors.plot(e, lndos, method=method) emax = -34 emin = -2000 eminimportant = -915 eSmax = -509 Smin = -1500 plt.axvline(eminimportant, linestyle=':', color='tab:gray') plt.axvline(eSmax, linestyle=':', color='tab:gray') #plt.axvline(emin) #plt.axvline(eSmax) plt.ylabel('$S/k_B$') plt.ylim(Smin, 0) plt.xlim(emin, emax) plt.xlabel('$E$') colors.legend()
print('only showing 1/%d of the frames' % skipby) print('numframes', numframes) for frame in range(1, numframes + 1): if frame % 25 == 0: print('working on frame %d/%d' % (frame, numframes)) 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, ps, lndostm = readnew.e_lndos_ps_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 = readnew.minT(datname) too_lo, too_hi = readnew.too_low_high_energy(datname) ax.axvline(-readnew.max_entropy_state(datname), color='r', linestyle=':') min_important_energy = int(readnew.min_important_energy(datname)) ax.axvline(-min_important_energy, color='b', linestyle=':') if too_lo is not None and suffix[:3] == 'sad': ax.axvline(-too_lo, color='b', linestyle='--') if too_lo is not None and suffix[:3] == 'sad': ax.axvline(-too_hi, color='r', linestyle='--') # Uncomment the following to plot a line at the
if system == 's000': N = filebase.split('-N')[-1] ff = filebase.split('-ff')[-1].split('-N')[0] ff = float(ff) # Get N directly from title. moves = iterations * float(N) if system == 'ising': N = filebase.split('N')[-1] moves = iterations * float(N) max_time = max(max_time, moves.max()) if energy > 0: plt.figure('error-at-energy-iterations') colors.plot(moves, erroratenergy, method=method[1:]) plt.title('Error at energy %g %s' % (energy, filebase)) plt.xlabel('# moves') plt.ylabel('error') colors.legend() plt.savefig('figs/%s-error-energy-%g.pdf' % (tex_filebase, energy)) plt.figure('round-trips-at-energy') colors.plot(moves, Nrt_at_energy, method=method[1:]) plt.title('Round Trips at energy %g, %s' % (energy, filebase)) plt.xlabel('# moves') plt.ylabel('Round Trips') colors.legend() plt.savefig('figs/%s-round-trips-%g.pdf' % (tex_filebase, energy)) plt.figure('error-at-energy-round-trips')
for frame in range(1, numframes + 1): if frame % 25 == 0: print(('working on frame %d/%d' % (frame, numframes))) plt.cla() ax.plot(best_e, best_hist, ':', color='0.5') for suffix_index in range(len(suffixes)): suffix = suffixes[suffix_index] basename = dataformat % (suffix, frame * skipby) try: datname = basename + '-transitions.dat' #print(readnew.moves(datname)) e, hist = readnew.e_hist(basename) colors.plot(e, hist, method=suffix) except (KeyboardInterrupt, SystemExit): raise except Exception as e: print(e) pass ax.set_xlabel(r'$E$') ax.set_ylim(1.1 * minhist, maxhist + 5) ax.set_xlim(mine, maxe) ax.set_ylabel(r'$\textrm{Histogram}$') colors.legend(loc='lower right') fname = '%s/frame%06d.png' % (moviedir, frame) plt.savefig(fname)
print('only showing 1/%d of the frames' % skipby) print('numframes', numframes) for frame in range(1, numframes+1): if frame % 25 == 0: print('working on frame %d/%d' % (frame, numframes)) 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, ps, lndostm = readnew.e_lndos_ps_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 = readnew.minT(datname) too_lo, too_hi = readnew.too_low_high_energy(datname) ax.axvline(-readnew.max_entropy_state(datname), color='r', linestyle=':') min_important_energy = int(readnew.min_important_energy(datname)) ax.axvline(-min_important_energy, color='b', linestyle=':') if too_lo is not None and suffix[:3] == 'sad': ax.axvline(-too_lo, color='b', linestyle='--') if too_lo is not None and suffix[:3] == 'sad': ax.axvline(-too_hi, color='r', 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]+'--')
for frame in range(1, numframes+1): if frame % 25 == 0: print('working on frame %d/%d' % (frame, numframes)) plt.cla() ax.plot(best_e, best_hist, ':', color='0.5') for suffix_index in range(len(suffixes)): suffix = suffixes[suffix_index] basename = dataformat % (suffix, frame*skipby) try: datname = basename+'-transitions.dat' #print(readnew.moves(datname)) e, hist = readnew.e_hist(basename) colors.plot(e, hist, method=suffix) except (KeyboardInterrupt, SystemExit): raise except Exception as e: print(e) pass ax.set_xlabel(r'$E$') ax.set_ylim(1.1*minhist, maxhist+5) ax.set_xlim(mine, maxe) ax.set_ylabel(r'$\textrm{Histogram}$') colors.legend(loc='lower right') fname = '%s/frame%06d.png' % (moviedir, frame) plt.savefig(fname)
print 'only showing 1/%d of the frames' % skipby print 'numframes', numframes for frame in xrange(numframes): if frame % 25 == 0: print 'working on frame %d/%d' % (frame, numframes) 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
data = np.loadtxt(datadir + 'wide-cv.txt') wideax.set_xlim(0, data[-1, 0]) wide_ymin = 89 wide_ymax = 190 wideax.set_ylim(wide_ymin, wide_ymax) # colors.plot(data[:,0], data[:,1], method='bench', axes=wideax) for method in files: fname = files[method][0.01] data = np.loadtxt(datadir + fname + '-cv.txt') widedata = np.loadtxt(datadir + fname + '-wide-cv.txt') if len(data) == 0: continue if 'sad' in method: colors.plot(data[:, 0], data[:, 1], method=r'SAD $\Delta E=0.01\epsilon$', axes=zoomax) colors.plot(widedata[:, 0], widedata[:, 1], method=r'SAD $\Delta E=0.01\epsilon$', axes=wideax) # fname = files[method][0.1] # if os.path.exists(datadir+fname+'-cv.txt'): # data = np.loadtxt(datadir+fname+'-cv.txt') # colors.plot(data[:,0], data[:,1], method=r'SAD $\Delta E=0.1\epsilon$', axes=zoomax) # widedata = np.loadtxt(datadir+fname+'-wide-cv.txt') # colors.plot(widedata[:,0], widedata[:,1], method=r'SAD $\Delta E=0.1\epsilon$', axes=wideax) else: colors.plot(data[:, 0], data[:, 1], method=method, axes=zoomax) colors.plot(widedata[:, 0], widedata[:, 1], method=method, axes=wideax) for method in extra_files:
# Formula to calculate N from title i.e. 100x10 # and use floor to always round up. N = np.floor(0.25*0.20*float(NxN[0])*float(NxN[-1])*float(NxN[-1])) ff = 1.0 # FIXME moves = iterations * N if filebase.startswith('s000'): N = filebase.split('-N')[-1] ff = filebase.split('-ff')[-1].split('-N')[0] ff = float(ff) # Get N directly from title. moves = iterations * float(N) max_time = max(max_time, moves.max()) if energy > 0: plt.figure('error-at-energy-iterations') colors.plot(moves, erroratenergy, method=method[1:]) plt.title('Error at energy %g %s' % (energy,filebase)) plt.xlabel('# moves') plt.ylabel('error') colors.legend() plt.savefig('figs/%s-error-energy-%g.pdf' % (tex_filebase, energy)) plt.figure('round-trips-at-energy' ) colors.plot(moves, Nrt_at_energy, method = method[1:]) plt.title('Round Trips at energy %g, %s' % (energy,filebase)) plt.xlabel('# moves') plt.ylabel('Round Trips') colors.legend() plt.savefig('figs/%s-round-trips-%g.pdf' % (tex_filebase, energy)) plt.figure('error-at-energy-round-trips')
matplotlib.use('Agg') print('true?') cv_data = pd.read_csv('%s/N%s-heat-capacity.csv' % (file_dir, N), delimiter='\t', encoding='utf-8', engine='python') #cv_data['cvref'] = cv_data['cvref'].astype(float) print(cv_data.head(10)) cv_headers = list(cv_data)[1:] print(cv_headers) # Begin plotting the heat capacity plt.figure('heat capacity plot') Temp = np.array(pd.to_numeric(cv_data['Temperature'], errors='coerce')) for name in cv_headers: cv = pd.to_numeric(cv_data[name], errors='coerce') colors.plot(1 / Temp, cv / N**2, method=name) colors.legend(loc='best') plt.xlabel(r'$\beta / J$') plt.ylabel(r'$c_V$ / $ k_B$') plt.xlim(0.3, 0.6) if N == 32: plt.ylim(0.3, 2.0) plt.savefig('../ising/N%i-Cv.pdf' % N) plt.show()
print 'trying method', method for subdirectory in directory: try: basename = 'data/lv/%s%s-movie/%s' % (filebase, method, subdirectory) e, hist = readandcompute.e_and_total_init_histogram(basename) datname = basename + '-transitions.dat' #min_T = readandcompute.minT(datname) hist_max = np.amax(hist) hist_norm = hist/hist_max # each method is normalized to itself. plt.figure('Histogram evolution vs Energy') plt.ylabel('Histogram') plt.xlabel('Energy') plt.subplot(len(directory),1,i) colors.plot(e, hist_norm, method=method[1:]) colors.legend() i = i + 1 # this is a hokey way to count through frames. except: continue #plt.tight_layout(pad=2, w_pad=0.0, h_pad=0.0) plt.suptitle('Maximum Entropy Error vs Iterations, %s' %filebase) plt.show()
for method in methods: i = 1 print('trying method', method) for subdirectory in directory: try: basename = 'data/lv/%s%s-movie/%s' % (filebase, method, subdirectory) e, hist = readandcompute.e_and_total_init_histogram(basename) datname = basename + '-transitions.dat' #min_T = readandcompute.minT(datname) hist_max = np.amax(hist) hist_norm = hist / hist_max # each method is normalized to itself. plt.figure('Histogram evolution vs Energy') plt.ylabel('Histogram') plt.xlabel('Energy') plt.subplot(len(directory), 1, i) colors.plot(e, hist_norm, method=method[1:]) colors.legend() i = i + 1 # this is a hokey way to count through frames. except: continue #plt.tight_layout(pad=2, w_pad=0.0, h_pad=0.0) plt.suptitle('Maximum Entropy Error vs Iterations, %s' % filebase) plt.show()
print 'only showing 1/%d of the frames' % skipby print 'numframes', numframes for frame in xrange(numframes): if frame % 25 == 0: print 'working on frame %d/%d' % (frame, numframes) 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):