gps = "get_particles" i = len(sys.argv) if(i!=2): print "usage: gen_particles_list.py snap" exit(1) facr = 1 # * rvir from AHF for maximal radial distance to include particles snap = int(sys.argv[1]) d = mys.d(snap) pdm=d+"particles_dm" xl,yl,zl,ml,rl = mys.getxyzmr(snap,2) nhalo= mys.get_nhalo(snap) os.system("rm "+d+"particles_dm") os.system("echo '"+str(nhalo)+"' >> "+pdm) for i in range(len(xl)): xc=str(xl[i]); yc=str(yl[i]); zc=str(zl[i]); r=str(facr*rl[i]) tmpdat = d+"tmp_"+str(i+1)+".dat" # all particles (DM/stars mixed) cmd1 = gps+" -inp "+d cmd1 +=" -xc "+xc+" -yc "+yc+" -zc "+zc+" -r "+r cmd1 +=">"+tmpdat cmd2 ="true" my.threadif(cmd1,cmd2,run,run,show,run) if(not loop): break #TODO: stars only
if (i != 2): print "usage: gen_particles_list.py snap" exit(1) facr = 1 # * rvir from AHF for maximal radial distance to include particles snap = int(sys.argv[1]) d = mys.d(snap) pdm = d + "particles_dm" xl, yl, zl, ml, rl = mys.getxyzmr(snap, 2) nhalo = mys.get_nhalo(snap) os.system("rm " + d + "particles_dm") os.system("echo '" + str(nhalo) + "' >> " + pdm) for i in range(len(xl)): xc = str(xl[i]) yc = str(yl[i]) zc = str(zl[i]) r = str(facr * rl[i]) tmpdat = d + "tmp_" + str(i + 1) + ".dat" # all particles (DM/stars mixed) cmd1 = gps + " -inp " + d cmd1 += " -xc " + xc + " -yc " + yc + " -zc " + zc + " -r " + r cmd1 += ">" + tmpdat cmd2 = "true" my.threadif(cmd1, cmd2, run, run, show, run) if (not loop): break #TODO: stars only
bndry = " "+sx+" "+sy+" "+sz+" "+sr+" " starbndrys =" -xs "+ssx+" -ys "+ssy+" -zs "+ssz+" -rs "+ssr+" " bndrys =" -xs "+sx+" -ys "+sy+" -zs "+sz+" -rs "+sr+" " bndryc =" -xc "+sx+" -yc "+sy+" -zc "+sz+" -rc "+sr+" " #bu: old bndry: #xmi= str(x[i]-f*r[i]); xma = str(x[i]+f*r[i]) #ymi= str(y[i]-f*r[i]); yma = str(y[i]+f*r[i]) #zmi= str(z[i]-f*r[i]); zma = str(z[i]+f*r[i]) #for gas: zma = z; for all else: -zma zma #bndry="-xmi "+xmi+" -xma "+xma+" -ymi "+ymi+" -yma "+yma+" -zmi "+zmi+" -zma "+zma cmd1 = "count_stars -inp "+d+bndryc+" >> star_counts.dat" #cmd2 = "plot_columns.py star_counts.dat 1 4" cmd2 = "calc_sfr.py star_counts.dat 0 4" my.threadif(cmd1,cmd2,calc,vis,show,run) # get DM particle positions for each halo cmd1 = "get_sphere_dm -inp "+d+bndryc+" > "+ddm+"dm_"+stri+".dat" cmd1+= "&& octreef "+ddm+"dm_"+stri+".dat > "+ddm+"rho_"+stri+".dat" cmd2 ="vis_part_proj_dm.py "+bndry+" "\ +ddm+"dm_"+stri+".dat "+ddm+"dm_part_"+stri+".png" cmd2+="; vis_dm_contour.py "+bndry+" "\ +ddm+"rho_"+stri+".dat "+ddm+"contour_"+stri+".png" my.threadif(cmd1,cmd2,calc,vis,show,run) # plot gas cmd1 ="amr2map -typ 1 -lma 17 -inp "+d+" -out "+dgas+"gas_boxall_"+stri cmd1 = cmd1 +".dat -dir z "+bndrys
bndry = " " + sx + " " + sy + " " + sz + " " + sr + " " starbndrys = " -xs " + ssx + " -ys " + ssy + " -zs " + ssz + " -rs " + ssr + " " bndrys = " -xs " + sx + " -ys " + sy + " -zs " + sz + " -rs " + sr + " " bndryc = " -xc " + sx + " -yc " + sy + " -zc " + sz + " -rc " + sr + " " #bu: old bndry: #xmi= str(x[i]-f*r[i]); xma = str(x[i]+f*r[i]) #ymi= str(y[i]-f*r[i]); yma = str(y[i]+f*r[i]) #zmi= str(z[i]-f*r[i]); zma = str(z[i]+f*r[i]) #for gas: zma = z; for all else: -zma zma #bndry="-xmi "+xmi+" -xma "+xma+" -ymi "+ymi+" -yma "+yma+" -zmi "+zmi+" -zma "+zma cmd1 = "count_stars -inp " + d + bndryc + " >> star_counts.dat" #cmd2 = "plot_columns.py star_counts.dat 1 4" cmd2 = "calc_sfr.py star_counts.dat 0 4" my.threadif(cmd1, cmd2, calc, vis, show, run) # get DM particle positions for each halo cmd1 = "get_sphere_dm -inp " + d + bndryc + " > " + ddm + "dm_" + stri + ".dat" cmd1 += "&& octreef " + ddm + "dm_" + stri + ".dat > " + ddm + "rho_" + stri + ".dat" cmd2 ="vis_part_proj_dm.py "+bndry+" "\ +ddm+"dm_"+stri+".dat "+ddm+"dm_part_"+stri+".png" cmd2+="; vis_dm_contour.py "+bndry+" "\ +ddm+"rho_"+stri+".dat "+ddm+"contour_"+stri+".png" my.threadif(cmd1, cmd2, calc, vis, show, run) # plot gas cmd1 = "amr2map -typ 1 -lma 17 -inp " + d + " -out " + dgas + "gas_boxall_" + stri cmd1 = cmd1 + ".dat -dir z " + bndrys cmd2 = "map2img.py -l --colormap=hot " + dgas + "gas_boxall_" + stri + ".dat "