Пример #1
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
Пример #2
0
        cmd = "cd "+d+" && gen_spheres.py "+str(nsnap)+" 1"
        if(brute):
            my.thread(cmd)
        else:
            my.run(cmd)
        if(not loop):
            break

if(action==5):
    print "> find center with shrinking spheres / sph densities"
    # have xs,xs_star set in the end
    for ncounter in range(nstop-nstart+1):
        nsnap = ncounter + nstart

        # shrink_spheres
        print mys.get_nhalo(nsnap)
        for i in range(mys.get_nhalo(nsnap)):
            cmd = "shrink_sphere.py "+str(nsnap)+" "+str(i+1)
            my.thread(cmd)
            cmd = "shrink_sphere_stars.py "+str(nsnap)+" "+str(i+1)
            my.thread(cmd)

            #break;

if(action==6):
    print "> get particles in AOI"

    for ncounter in range(nstop-nstart+1):
        nsnap = ncounter + nstart
        d  = mys.d(nsnap)
        my.mkdir(d+"stars"); my.mkdir(d+"dm")
Пример #3
0
import os
import initialize as my
import mys

os.nice(10)

show = True
run = True
loop = True

i = len(sys.argv)
if (i != 2):
    print "usage: gen_particles_dm.py snap"
    exit(1)

snap = int(sys.argv[1])
d = mys.d(snap)
pdm = d + "particles_dm"
nhalo = mys.get_nhalo(snap)
os.system("rm " + d + "particles_dm")
os.system("echo '" + str(nhalo) + "' >> " + pdm)
for c in range(nhalo):
    tmpdat = d + "tmp_" + str(c + 1) + ".dat"
    cmd = "echo $(wc -l " + tmpdat + "|cut -d' ' -f1) >> " + pdm + ";"
    cmd = cmd + "cat " + tmpdat + ">>" + pdm + ";"
    cmd = cmd + "rm " + tmpdat
    if (show): print(cmd)
    if (run): os.system(cmd)
    if (not loop): break
    # TODO: stars only
Пример #4
0
        cmd = "cd " + d + " && gen_spheres.py " + str(nsnap) + " 1"
        if (brute):
            my.thread(cmd)
        else:
            my.run(cmd)
        if (not loop):
            break

if (action == 5):
    print "> find center with shrinking spheres / sph densities"
    # have xs,xs_star set in the end
    for ncounter in range(nstop - nstart + 1):
        nsnap = ncounter + nstart

        # shrink_spheres
        print mys.get_nhalo(nsnap)
        for i in range(mys.get_nhalo(nsnap)):
            cmd = "shrink_sphere.py " + str(nsnap) + " " + str(i + 1)
            my.thread(cmd)
            cmd = "shrink_sphere_stars.py " + str(nsnap) + " " + str(i + 1)
            my.thread(cmd)

            #break;

if (action == 6):
    print "> get particles in AOI"

    for ncounter in range(nstop - nstart + 1):
        nsnap = ncounter + nstart
        d = mys.d(nsnap)
        my.mkdir(d + "stars")