예제 #1
0
if (i != 3):
    print("shrink_sphere.py snap hid")
    exit(0)

snap = int(sys.argv[1])
hid = int(sys.argv[2])

eps = 1e-5
frad = 0.90  # shrinked sphere has radius frad*maxr, i.e. frad = 0.90 means 10% smaller

if (not mys.exists_snap(snap)):
    print("snapshot " + str(snap) + " missing")
    exit(0)

xc, yc, zc, mvir, rvir = mys.getxyzmr(snap, 1)
halo = my.open_file(mys.d(snap) + "dm/dm_" + str(hid) + ".dat", "r")
x = []
y = []
z = []
m = []
for line in halo:
    val = line.split()
    m.append(float(val[0]))
    x.append(float(val[1]))
    y.append(float(val[2]))
    z.append(float(val[3]))

x = array(x)
y = array(y)
z = array(z)
m = array(m)
예제 #2
0
import sys
import lib.initialize as my
import lib.mysql as mys
from numpy import zeros

if(len(sys.argv)!=3):
    print("usage: merger_tree.py snap1 snap2")
    print("assumption: output_00snap1,2 contain particles_dm in AHF format")
    exit(1)

snap1 = int(sys.argv[1]); snap2 = int(sys.argv[2])

# read in halos repeatedly
fname=mys.d(snap1)+"particles_dm"
print('file = ', fname)
in1 = my.open_file(fname,"r")
alm1 = int(in1.readline())
size1 = []; split1 = []
for i in range(alm1):
    size = int(in1.readline())
    size1.append(size)
    part = []
    for c in range(size):
        part.append(int(in1.readline()))
    split1.append(part)
in1.close()

in2 = my.open_file(mys.d(snap2)+"particles_dm","r")
alm2 = int(in2.readline())
size2 = []; split2 = []
for i in range(alm2):
예제 #3
0
if(i!=3):
    print("shrink_sphere.py snap hid")
    exit(0)

snap = int(sys.argv[1])
hid  = int(sys.argv[2])

eps = 1e-5
frad = 0.90 # shrinked sphere has radius frad*maxr, i.e. frad = 0.90 means 10% smaller

if(not mys.exists_snap(snap)):
    print("snapshot "+str(snap)+" missing")
    exit(0)

xc, yc, zc, mvir, rvir = mys.getxyzmr(snap,1)
halo = my.open_file(mys.d(snap)+"dm/dm_"+str(hid)+".dat","r")
x=[];y=[];z=[];m=[]
for line in halo:
    val=line.split()
    m.append(float(val[0]))
    x.append(float(val[1]))
    y.append(float(val[2]))
    z.append(float(val[3]))

x = array(x); y = array(y); z = array(z); m = array(m)
if(len(m)==0):
    print("no particles, skipping shrinking sphere")
    exit(0)

def converged(xc,yc,zc,xc2,yc2,zc2):
    print(max(abs(xc-xc2), abs(yc-yc2),abs(zc-zc2)))
예제 #4
0
    print("shrink_sphere.py snap hid")
    exit(0)

snap=int(sys.argv[1])
hid=int(sys.argv[2])

eps=1e-5
frad = 0.9 # shrinked sphere has radius frad*maxr, i.e. frad = 0.90 means 10% smaller

#print("missing file")
if(not mys.exists_snap(snap)):
    print("snapshot "+str(snap)+" missing")
    exit(0)

xc,yc,zc,mvir,rvir=mys.getxyzmr(snap,1)
halo = my.open_file(mys.d(snap)+"stars/stars_"+str(hid)+".dat","r")
x=[];y=[];z=[];m=[]
for line in halo:
    val=line.split()
    m.append(float(val[0]))
    x.append(float(val[1]))
    y.append(float(val[2]))
    z.append(float(val[3]))

x = array(x); y = array(y); z = array(z); m = array(m)
#print(x)

def converged(xc,yc,zc,xc2,yc2,zc2):
    return  abs(xc-xc2)/abs(xc)   < eps \
        and abs(yc-yc2)/abs(yc)   < eps \
        and abs(zc-zc2)/abs(zc)   < eps #\
예제 #5
0
# (c) 2014 ETHZ, Pascal Steger, [email protected]

import sys
from numpy import zeros
import lib.initialize as my
import lib.mysql as mys

if(len(sys.argv)!=2):
    print("usage: substructure.py snap")
    print("assumption: output_snap contains particles_dm in AHF format")
    print("wrong number of arguments")
    exit(1)

snap = int(sys.argv[1])
# read in halos repeatedly
inf = my.open_file(mys.d(snap)+"particles_dm","r")
alm = int(inf.readline())
size = []; split = []
for i in range(alm):
    siz = int(inf.readline())
    size.append(siz)
    part = []
    for c in range(siz):
        part.append(int(inf.readline()))
    split.append(part)
inf.close()
print("read in successful")


def count_shared(m1,m2):
    cc = 0