# grid of scalar radius from center (in units of cell size)
rr = numpy.sqrt((x - xc)**2 + (y - yc)**2 + (z - zc)**2)
# components of unit radius vector from center
ux, uy, uz = (x - xc) / rr, (y - yc) / rr, (z - zc) / rr

# rescale radius to be in parsecs
rr *= args.boxsize/nx

# radial velocity is dot product of vector velocity with unit radius vector
vr = vx*ux + vy*uy + vz*uz

# rescale velocities to be in km/s
vr /= 1.e5

import molfrac
xmol = molfrac.molfrac(AV)

# List of weights will produce RGB pdf images
weights = [
    xn*xmol,                            # molecular
    xn*(1.0-xmol),                      # neutral
    1.0-xn                              # ionized
    ]


# Now make the plots
import pyx
pyx.text.set(mode="latex")
# pyx.text.preamble("""\usepackage{mathptmx}""")
bivar.printextra = 0
bivar.Graph.figwidth = 6
Exemple #2
0
    raise NotImplementedError("Only Ostar and Bstar are implemented, sorry!")

savedir = "lya-%s-%4.4i" % (args.runid, args.itime)

if not os.path.isdir(savedir):
    os.mkdir(savedir)

vx, vy, vz, xn, av, dd, te = [load_fits(id) for id in ["vx", "vy", "vz", "xn", "AV", "dd", "te"]]

x, y, z, = numpy.ogrid[0 : star.nxg, 0 : star.nyg, 0 : star.nzg]  # grid coordinates
# grid of scalar radius from center (in units of cell size)
rr = numpy.sqrt((x - star.i0) ** 2 + (y - star.j0) ** 2 + (z - star.k0) ** 2)
rr[rr == 0] = 1.0
rr *= star.xmax / star.nxg  # convert to cm

mm = molfrac.molfrac(av)
ni = dd * (1.0 - xn) / MP / MU
nn = dd * xn * (1.0 - mm) / MP / MU
nm = dd * xn * mm / MP / MU
ly = lya_emissivity(ni, te)
jc = fuv_field(av, rr)
print jc.max(), jc.min()
jc *= star.qh0 * star.fuv_euv_ratio / (4 * pi)
print jc.max(), jc.min()

for id, data in [
    ["temperature", te],
    ["vel_x", vx],
    ["vel_y", vy],
    ["vel_z", vz],
    ["n_hi", nn],