Classes | Functions
wirecell.gen.sim Namespace Reference

Classes

class  Depos
 
class  Frame
 
class  NumpySaver
 

Functions

def baseline_subtract (frame)
 
def parse_channel_boundaries (cb)
 
def group_channel_indices (channels, boundaries=())
 

Detailed Description

Work with sim data.

fixme: this module is poorly named.

Function Documentation

def wirecell.gen.sim.baseline_subtract (   frame)
Return a new frame array (chan x tick) were each channel row has
its baseline subtracted.

Definition at line 15 of file sim.py.

15 def baseline_subtract(frame):
16  '''
17  Return a new frame array (chan x tick) were each channel row has
18  its baseline subtracted.
19  '''
20  # gotta transpose around to get the right shapes to trigger broadcasting.
21  return (frame.T - numpy.median(frame, axis=1)).T
22 
23 
def baseline_subtract(frame)
Definition: sim.py:15
def wirecell.gen.sim.group_channel_indices (   channels,
  boundaries = () 
)
Given a list of channels, return a list of lists where each
sublist is a sequential set.  If a sequence of boundaries are
given, then force a grouping on that channel even if there's not
jump.

Definition at line 30 of file sim.py.

30 def group_channel_indices(channels, boundaries=()):
31  '''
32  Given a list of channels, return a list of lists where each
33  sublist is a sequential set. If a sequence of boundaries are
34  given, then force a grouping on that channel even if there's not
35  jump.
36  '''
37 
38  print ("Channel boundaries: %s" % str(boundaries))
39 
40  channels = numpy.asarray(channels)
41  chan_list = channels.tolist()
42  binds = list()
43  for b in boundaries:
44  try:
45  i = chan_list.index(b)
46  except ValueError:
47  continue
48  binds.append(i)
49 
50  chd = channels[1:] - channels[:-1]
51  chjumps = [-1] + list(numpy.where(chd>1)[0]) + [channels.size-1]
52  ret = list()
53  for a,b in zip(chjumps[:-1], chjumps[1:]):
54  #print a,b,channels[a+1:b+1]
55  a += 1
56  b += 1
57 
58  gotsome = 0
59  for bind in binds:
60  if a < bind and bind < b:
61  ret.append((a,bind))
62  ret.append((bind,b))
63  gotsome += 1
64  if gotsome == 0:
65  ret.append((a,b))
66  return ret
67 
def group_channel_indices(channels, boundaries=())
Definition: sim.py:30
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
static QCString str
def wirecell.gen.sim.parse_channel_boundaries (   cb)

Definition at line 24 of file sim.py.

25  if type(cb) != type(""):
26  return cb # assume already parsed.
27  return tuple(map(int, cb.split(',')))
28 
29 
def parse_channel_boundaries(cb)
Definition: sim.py:24