예제 #1
0
 def onShrink(self, event):
     nstart,nstop=mys.get_range()
     # have xs,xs_star set in the end
     for nc in range(nstop-nstart+1):
         nsnap = nc + nstart
         if(not mys.snap_exists(nsnap)):
             continue
         print(mys.get_nhalo(nsnap))
         for i in range(3):#range(mys.get_nhalo(nsnap)):
             if(not mys.exists_snap(nsnap)):
                 print("snapshot "+str(nsnap)+" missing")
                 continue
             cmd = "shrink_sphere.py "+str(nsnap)+" "+str(i+1)
             my.run(cmd)
             if(not mys.is_dmonly()):
                 cmd = "shrink_sphere_stars.py "+str(nsnap)+" "+str(i+1)
                 my.run(cmd)
             # TODO: if empty xs (shrinking sphere algorithm did not succeed: use xc)
     my.done()
예제 #2
0
 def onShrink(self, event):
     nstart, nstop = mys.get_range()
     # have xs,xs_star set in the end
     for nc in range(nstop - nstart + 1):
         nsnap = nc + nstart
         if (not mys.snap_exists(nsnap)):
             continue
         print(mys.get_nhalo(nsnap))
         for i in range(3):  #range(mys.get_nhalo(nsnap)):
             if (not mys.exists_snap(nsnap)):
                 print("snapshot " + str(nsnap) + " missing")
                 continue
             cmd = "shrink_sphere.py " + str(nsnap) + " " + str(i + 1)
             my.run(cmd)
             if (not mys.is_dmonly()):
                 cmd = "shrink_sphere_stars.py " + str(nsnap) + " " + str(
                     i + 1)
                 my.run(cmd)
             # TODO: if empty xs (shrinking sphere algorithm did not succeed: use xc)
     my.done()
예제 #3
0
# choose: get_particles    for all particles
#         get_particles_dm for dm  particles only
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