Beispiel #1
0
from gaepsi.cosmology import WMAP7
from sys import argv
from nishitab import subhalodtype as nishitabdtype
from matplotlib.figure import Figure
from matplotlib import cm
snapid = int(argv[1])
snappath = '/physics/yfeng1/mb2/snapdir/snapdir_%03d/snapshot_%03d.%%d' %(snapid,
        snapid)
nishitabpath = '/physics/yfeng1/mb2/galaxy_props/%03d/subhalo_tab_%03d.bin' \
          % (snapid, snapid)
N = numpy.fromfile(nishitabpath, 'i4', 1)[0]
nishitab = \
        numpy.memmap('/physics/yfeng1/mb2/galaxy_props/%03d/subhalo_tab_%03d.bin' \
          % (snapid, snapid), mode='r', offset=4, dtype=nishitabdtype, shape=N)

ct = GaplotContext()
ct.use(snappath, 'cmugadget', periodic=True)
print ct.C['Ntot']
print ct.C['redshift']

halomass = numpy.array([100, 200, 500, 800, 1000, 2000, 5000, 10000, 20000, 50000], dtype='f8')
haloarg = [numpy.abs(nishitab['mass'] / mass - 1.0).argmin()\
         for mass in halomass]

center = nishitab['pos'][haloarg]
vel = nishitab['vel'][haloarg]
mass = nishitab['mass'][haloarg]
#radius = WMAP7.Rvir(nishitab['mass'][haloarg], z=5.0) * 1.5
radius = WMAP7.Rvir(nishitab['mass'][haloarg], z=ct.C['redshift'])
print center, mass, radius
raise