Functions | Variables
wirecell.gen.test.plot_g4tuple Namespace Reference

Functions

def load_depos (filename)
 
def plot_dedx (depos)
 
def plot_dndx (depos)
 
def plot_nxz (depos)
 

Variables

string depo_keys = "xyzqtsn"
 
 depos = load_depos(sys.argv[1])
 

Function Documentation

def wirecell.gen.test.plot_g4tuple.load_depos (   filename)

Definition at line 12 of file plot_g4tuple.py.

12 def load_depos(filename):
13  if filename.endswith(".bz2"):
14  fp = bz2.BZ2File(filename)
15  else:
16  fp = open(filename);
17  jdat = json.loads(fp.read())
18  depos = list()
19  for jdepo in jdat["depos"]:
20  depo = tuple([jdepo[key] for key in depo_keys])
21  if depo[5] == 0.0:
22  continue
23  depos.append(depo)
24  return numpy.asarray(depos)
25 
int open(const char *, int)
Opens a file descriptor.
def wirecell.gen.test.plot_g4tuple.plot_dedx (   depos)

Definition at line 26 of file plot_g4tuple.py.

26 def plot_dedx(depos):
27  dE = depos[:,3]
28  dX = depos[:,5]
29  dEdX = dE/dX
30  h = numpy.histogram(dEdX, 1000, (0,10))
31  plt.clf(); plt.plot(h[1][:-1], h[0])
32  plt.savefig("g4tuple-dedx.pdf")
33  pass
34 
def wirecell.gen.test.plot_g4tuple.plot_dndx (   depos)

Definition at line 35 of file plot_g4tuple.py.

35 def plot_dndx(depos):
36  dN = depos[:,4]
37  dX = depos[:,5]
38  dNdX = dN/dX
39  print dNdX[0]
40  h = numpy.histogram(dNdX, 150, (5.0e4,2.0e5))
41  plt.clf(); plt.semilogy(h[1][:-1], h[0])
42  plt.savefig("g4tuple-dndx.pdf")
43  pass
44 
def wirecell.gen.test.plot_g4tuple.plot_nxz (   depos)

Definition at line 45 of file plot_g4tuple.py.

45 def plot_nxz(depos):
46  "Plot colz number as X vs Z (transverse)"
47  x = depos[:,0]
48  z = depos[:,2]
49  n = depos[:,4]
50 
51 
52  xedges = numpy.linspace(90, 120.0, 300)
53  zedges = numpy.linspace(10, 70.0, 600)
54 
55  #H, xedg, zedg = numpy.histogram2d(z, x, bins=(xedges, zedges), weights=n)
56  fig = plt.figure()
57  ax = fig.add_subplot(111)
58  ax.set_title("Electrons per mm$^2$")
59  #X, Z = numpy.meshgrid(xedges, zedges)
60  #cax = ax.pcolormesh(X, Z, H)
61  #cax = ax.imshow(H)#, interpolation='nearest', origin='low',
62  # # extent=[xedg[0], xedg[-1], zedg[0], zedg[-1]])
63  h = ax.hist2d(x,z,bins=(xedges, zedges), weights=n)
64  ax.set_xlabel("X [cm]")
65  ax.set_ylabel("Z [cm]")
66  plt.colorbar(h[3], ax=ax)
67  fig.savefig("g4tuple-nxz.pdf")
68 
69 

Variable Documentation

string wirecell.gen.test.plot_g4tuple.depo_keys = "xyzqtsn"

Definition at line 10 of file plot_g4tuple.py.

wirecell.gen.test.plot_g4tuple.depos = load_depos(sys.argv[1])

Definition at line 72 of file plot_g4tuple.py.