def draw_tracks(): nhalos = len(env.mt[1:]) for i,track in enumerate(env.mt[1:]): # for i in range(env.mt.n_halos): ##if 1 #if i+1 not in [414,32]: continue ## i != 1 ## && i != 2 ## && i != 3 ## && i != 4 ## && i != 5 ## && i != 31 ## i != 412 ## && i >= 64 ## && i != 1738 ##endif # r,g,b = color_ramp_tipsy(float(i) / nhalos) #glColor4f(r, g, b, 1) glColor4f(1, 1, 1, .1) lx=0 ly=0 lz=0 if len(track[1:]): glBegin(GL_LINE_STRIP) for tinfo in track[1:]: t = tinfo['snap_id'] ii = tinfo['gid'] if not ii: continue halo = env.halos[t][ii] M = halo.Mass hx = halo.X hy = halo.Y hz = halo.Z glVertex3f(hx, hy, hz) lx = hx ly = hy lz = hz glEnd()
def draw_halo(halo, ramp, i): hx = halo.X hy = halo.Y hz = halo.Z #r2 = (Ex - hx)**2 + (Ey - hy)**2 + (Ez - hz)**2 #float R = halo.w.Mass #float R = halo.w.Rmax #float R = halo.w.Radius * 0.001 R = halo.Radius * 0.0001 #float R = halo.w.Radius * 0.001 #float R = 0.001 #hr2 = R**2 #if (r2 <= hr2) continue #r = float(i) / len(env.mt) #g = float(i) / len(env.mt) #b = float(i) / len(env.mt) #a = fabs(1/(i+1)) # m = [ # halo.Eax, halo.Ebx, halo.Ecx, 0, # halo.Eay, halo.Eby, halo.Ecy, 0, # halo.Eaz, halo.Ebz, halo.Ecz, 0, # 0, 0, 0, 1 # ] glTranslatef(hx, hy, hz) if False: glBegin(GL_LINES) glColor4f(1,0,0,1) glVertex3f(0,0,0) glVertex3f(halo.Eax*R*halo.a, halo.Eay*R*halo.a, halo.Eaz*R*halo.a) # glColor4f(0,1,0,1) # glVertex3f(0,0,0) # glVertex3f(halo.Eax*R*halo.a/2, halo.Eay*R*halo.a/2, halo.Eaz*R*halo.a/2) glColor4f(0,1,0,1) glVertex3f(0,0,0) glVertex3f(halo.Ebx*R*halo.b, halo.Eby*R*halo.b, halo.Ebz*R*halo.b) glColor4f(0,0,1,1) glVertex3f(0,0,0) glVertex3f(halo.Ecx*R*halo.c, halo.Ecy*R*halo.c, halo.Ecz*R*halo.c) glEnd() if False: glBegin(GL_LINES) glColor4f(1,0,0,1) glVertex3f(0,0,0) glVertex3f(halo.VX, halo.VY, halo.VZ) glEnd() #endif # glScalef(halo.a * R, # halo.b * R, # halo.c * R) alpha = 0.1 #exp(-pow((int)t-(int)env.t,2) / env.t_max) / 2 #alpha = exp(-pow((int)t-(int)env.t,2) / env.t_max) / 2 #fprintf(stderr, "%f\n", alpha) #color_ramp_tipsy((float)(n)/7., &r, &g, &b) if alpha > .01: #color_ramp_wrbb(&r, &g, &b) #color_ramp_grey(&r, &g, &b) #color_ramp_hot2cold(&r, &g, &b) #color_ramp_astro(&r, &g, &b) #color_ramp_tipsy((float)(i+1) / 10., &r, &g, &b) #r,g,b = color_ramp_tipsy(float(i) / nhalos) # if halo.gid == env.track_id: # r,g,b = 1,0,0 # else: r,g,b = color_ramp_tipsy(ramp) #if 0 # if (t == env.t) # glColor4f(1, 0, 0, 1) # else #endif glColor4f(r, g, b, .8) # if i in [32, 414]: # glColor4f(r,g,b, 1) mi = log10(R) #print mi if mi > -4: if mi > -1: mi = 2 elif mi > -2: mi = 1 elif mi > -3: mi = 0 else: mi = 0 glCallList(sphere[int(mi)]) else: glPointSize(R * 1e4) glBegin(GL_POINTS) glVertex3f(0,0,0) glEnd()