2 import numpy
as np, h5py, math
3 import sys, os, warnings
4 import matplotlib.pyplot
as plt
8 This script transforms the initial condition from
9 (tau, x, y, eta) frame to (t, x, y, z) frame. This
10 conversion assumes longitudinal Bjorken expansion
13 The entropy density in longitudinal-local frame at
14 constant proper time tau0 is:
15 s(tau0, x, y, eta) = s0(x,y,eta)/tau0
16 = ns0(x,y,eta) <-- trento3d
18 Assuming Bjorken expansion for a short proper time,
19 s(tau, x, y, eta) = 1/tau*s0(x,y,eta)
20 = tau0/tau*ns0(x,y,eta) -- (1)
22 Expression (1) is transformed into (t, x, y, z) via,
23 s'(t0, x, y, z) = 1/tau*ns0(x, y, eta)
24 tau = sqrt(t0^2 - z^2)
25 eta = 1/2*ln[(t0+z)/(t0-z)]
26 where tau0 is absorbed into normalization of ns0
27 (see --normalization option of the trento3d model).
30 {:s} trento3d-hdf5-output t0 [list-of-event-id-to-convert]
32 For example, to convert all events to t0=1fm/c:
34 To convert only events #2 and #3 to t0=1fm/c:
37 print(help.__doc__.format(__file__, __file__, __file__))
43 Nx, Ny, Neta = field.shape
44 deta = dataset.attrs[
'deta']
45 dxy = dataset.attrs[
'dxy']
46 Lx, Ly, Leta = Nx*dxy/2., Ny*dxy/2., (Neta-1)*deta/2.
47 x = np.linspace(-Lx, Lx, Nx)
48 y = np.linspace(-Ly, Ly, Ny)
49 eta = np.linspace(-Leta, Leta, Neta)
51 z_max = t0*math.tanh(6.)
52 zarray = np.linspace(-z_max, z_max, Neta)
54 new_field = np.zeros_like(field)
57 eta = 0.5*np.log((t0+z)/(t0-z))
58 if np.abs(eta) > Leta:
60 residue, index = math.modf((eta+Leta)/deta)
62 new_field[:,:,iz] = ( field[:,:,index] *(1.-residue) \
63 + field[:,:,index+1]*residue) \
65 return x, y, zarray, new_field
70 fig, ax = plt.subplots(1, 1)
71 ax.plot(z, np.sum(s, axis=(0,1))*dx*dy,
'ro-')
72 ax.set_xlabel(
r'$z$ [fm]', size=15)
73 ax.set_title(
r'Local-rest-frame entropy in $t-z$ coordinates', size=15)
74 ax.set_ylabel(
r'$ds/dV$ [Arb. units.]', size=15)
75 plt.subplots_adjust(wspace=0.15, bottom=0.2)
80 if len(sys.argv) <= 2:
83 f = h5py.File(sys.argv[1],
'r')
84 t0 = float(sys.argv[2])
85 elist = ['event_{}'.
format(index)
for index
in sys.argv[3:]] \
86 if len(sys.argv)>=4
else list(f.keys())
88 x, y, z, s =
convert(f[eid], t0)
90 if __name__ ==
"__main__":