def GetNNStatsMany(main_id, min, max): folder = './dat/' + main_id + '/' fname = main_id + 'stats_NN.csv' fout = folder + fname ensure_dir(fout) with open(fout,'w') as f: for i in range(min, max): curr_id = main_id + str(i) [n_s, n_c, r_c, coords] = read(curr_id) stats = GetNNStatsIndiv(curr_id, n_s, n_c, r_c, coords) for s in stats: print s f.write(str(s)) f.write(',') f.write('\n') f.close()
def Download(res, curr_id): print 'running tm.download...' [n_s, n_c, r_c, coords] = readcenters.read(curr_id) down_folder = './dat/' + curr_id + '/Download/' ensure_dir(down_folder) cmd = 'scp ' + '[email protected]:/home/chaneyl/' + curr_id + '/out/* ' + down_folder os.system(cmd)
def PlotSk(curr_id): [n_s, n_c, r_c, coords] = readcenters.read(curr_id) print 'plotting Sk...' plt.figure(figsize=(12.0,4.0)) for i in range(0,n_s): fname = './dat/' + curr_id + '/Sk/' + curr_id + '_Sk_' + str(i) + '.txt' [k, Sk] = ReadSk(fname) axes_indiv = plt.subplot(1, n_s + 2, i+1) FormatPlotSk(axes_indiv, 'species {:d}'.format(i)) [popt, pcov, fit_k, fit_Sk] = FitSk(k,Sk) PlotSkFit(popt, pcov, fit_k, fit_Sk, axes_indiv) plt.loglog(k,Sk) # run for all fname = './dat/' + curr_id + '/Sk/' + curr_id + '_Sk_T.txt' [k, Sk] = ReadSk(fname) axes_combined = plt.subplot(1, n_s + 2, n_s+1) FormatPlotSk(axes_combined, 'all species') [popt, pcov, fit_k, fit_Sk] = FitSk(k,Sk) PlotSkFit(popt, pcov, fit_k, fit_Sk, axes_combined) plt.loglog(k,Sk) # run for delaunay fname = './dat/' + curr_id + '/Sk/' + curr_id + '_Sk_del.txt' [k, Sk] = ReadSk(fname) axes_delaunay = plt.subplot(1, n_s + 2, n_s+2) FormatPlotSk(axes_delaunay, 'delaunay') [popt, pcov, fit_k, fit_Sk] = FitSk(k,Sk) PlotSkFit(popt, pcov, fit_k, fit_Sk, axes_delaunay) plt.loglog(k,Sk) fname = curr_id + '_Sk.eps' fout = './dat/' + curr_id + '/Plots/' + fname ensure_dir(fout) plt.suptitle('structure factor, S(k)', fontsize=12) plt.savefig(fout, bbox_inches=0, dpi = 300)
def Upload(curr_id, numbands): print "running TE.upload..." [n_s, n_c, r_c, coords] = readcenters.read(curr_id) [N, walls] = getWallsNonDel(curr_id, n_s, coords) N1 = 300 rad = MakeRad(1) for r in rad: fname_make = CreateMakeFile(curr_id, r, N) fname_define = CreateDefineFile(curr_id, N1, r, walls) fname_param = CreateFileParam(curr_id, numbands, N1, r, fname_make, fname_define) fname_run = CreateFileRun(curr_id, numbands, r, fname_param)
def MakePlots(curr_id, opt): [n_s, n_c, r_c, coords] = readcenters.read(curr_id) N = 0 for i in range(0,n_s): N += n_c[i] delaunaymap.RunDelMap(curr_id, n_s, coords) #GetNN(curr_id, n_s, n_c, r_c, coords) GetNN(curr_id, n_s, n_c, r_c, coords) PlotCenters(curr_id, n_s, n_c, r_c, coords) #PlotSk(curr_id, n_s) # elif opt==2: #subbands = [97, 98, 99, 100, 101, 102, 103, 198, 199, 200, 201, 202, 203, 297, 298, 299, 300, 301, 302, 303] subbands = [97, 98, 99, 100, 101, 102, 298, 299, 300, 301, 302]
def Upload(res, curr_id, numbands, N_part): print 'running tm.upload...' [n_s, n_c, r_c, coords] = readcenters.read(curr_id) N = 0 for i in range(0,n_s): N += n_c[i] rad = MakeRad(res, n_s) for r in rad: fname_make = CreateMakeFile(curr_id, N, n_s, r) fname_define = CreateDefineFile(curr_id, N, n_s, n_c, r, coords, N_part) fname_param = CreateFileParam(curr_id, n_s, r, numbands, N, fname_make, fname_define, N_part) fname_run = CreateFileRun(curr_id, n_s, r, numbands, fname_param) MakeQsub(curr_id, res, n_s, rad)
def CalcSk(curr_id): fout_Sk = './dat/' + curr_id + '/Sk/' + curr_id + '_Sk_' ensure_dir(fout_Sk) [n_s, n_c, r_c, coords] = readcenters.read(curr_id) N = 0 for i in range(0,n_s): N += n_c[i] total_in = [maxx, maxy, N] for i in range(0,n_s): inputs = [maxx, maxy, n_c[i]] for j in range(0,n_c[i]): tmpx = coords[i][j][0] tmpy = coords[i][j][1] inputs.extend( [ tmpx, tmpy ] ) total_in.extend( [ tmpx, tmpy ] ) outname = fout_Sk + str(i) + '.txt' RunSk(inputs, outname) outname = fout_Sk + 'T.txt' RunSk(total_in, outname) del_fin = './dat/' + curr_id + '/Del/' + curr_id + '_del_T.txt' del_data = list(csv.reader( open(del_fin, 'rb') , delimiter = '\t' )) del_in = [maxx, maxy, len(del_data)] for i in range( len(del_data) ): tmpx = float(del_data[i][0]) tmpy = float(del_data[i][1]) del_in.extend( [tmpx, tmpy] ) outname = fout_Sk + 'del.txt' RunSk(del_in,outname)