Functions
wirecell.gen.plots Namespace Reference

Functions

def numpy_saver (filename, outfile)
 

Detailed Description

Make some plots from simulation output

Function Documentation

def wirecell.gen.plots.numpy_saver (   filename,
  outfile 
)
plot data from Numpy*Saver files

Definition at line 10 of file plots.py.

10 def numpy_saver(filename, outfile):
11  '''
12  plot data from Numpy*Saver files
13  '''
14  tick1=0
15  tick2=500
16 
17  fp = numpy.load(filename)
18  frame = fp['frame__0'].T
19  channels = fp['channels__0']
20  chd = channels[1:] - channels[:-1]
21  chjumps = [0] + list(numpy.where(chd>1)[0]) + [channels.size-1]
22  indjumps = zip(chjumps[:-1], chjumps[1:])
23 
24  njumps = len(indjumps)
25  fig, axes = plt.subplots(nrows=njumps, ncols=1)
26  if njumps == 1:
27  axes = [axes]
28 
29  for ax, (ind1, ind2) in zip(axes, indjumps):
30  ch1 = channels[ind1+1]
31  ch2 = channels[ind2]
32 
33  extent = (tick1, tick2, ch2, ch1)
34 
35  print ( "array ind: [%4d,%4d] channels: [%4d,%4d] %d" % (ind1,ind2, ch1, ch2, ind2-ind1+1))
36  im = ax.imshow(frame[ind1+1:ind2,tick1:tick2],aspect='auto')#,extent=extent)
37  plt.colorbar(im, ax=ax)
38 
39  plt.savefig(outfile)
40  return fig,axes
41 
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def numpy_saver(filename, outfile)
Definition: plots.py:10