Public Member Functions | Public Attributes | List of all members
wirecell.sigproc.response.ResponseFunction Class Reference
Inheritance diagram for wirecell.sigproc.response.ResponseFunction:

Public Member Functions

def __init__ (self, plane, region, pos, domainls, response, impact=None)
 
def __call__ (self, time)
 
def resample (self, nbins)
 
def dup (self, kwds)
 
def nbins (self)
 
def asdict (self)
 
def shaped (self, gain=14 *units.mV/units.fC, shaping=2.0 *units.us, nbins=None)
 
def __str__ (self)
 

Public Attributes

 plane
 
 region
 
 pos
 
 domainls
 
 response
 
 times
 
 impact
 

Detailed Description

A response function object holds the response wave function and metadata.

Note: time is assumed to be in Wire Cell system of units (ns).  This is NOT seconds.

Definition at line 88 of file __init__.py.

Constructor & Destructor Documentation

def wirecell.sigproc.response.ResponseFunction.__init__ (   self,
  plane,
  region,
  pos,
  domainls,
  response,
  impact = None 
)

Definition at line 94 of file __init__.py.

94  def __init__(self, plane, region, pos, domainls, response, impact=None):
95  plane = plane.lower()
96  assert plane in 'uvw'
97  self.plane = plane
98  self.region = region
99  self.pos = tuple(pos)
100  self.domainls = domainls
101  self.response = response
102  self.times = numpy.linspace(*self.domainls)
103  self.impact = impact
104 
105 
def __init__(self, plane, region, pos, domainls, response, impact=None)
Definition: __init__.py:94

Member Function Documentation

def wirecell.sigproc.response.ResponseFunction.__call__ (   self,
  time 
)

Definition at line 106 of file __init__.py.

106  def __call__(self, time):
107  return numpy.interp(time, self.times, self.response)
108 
def wirecell.sigproc.response.ResponseFunction.__str__ (   self)

Definition at line 153 of file __init__.py.

153  def __str__(self):
154  blah = "<ResponseFunction plane=%s region=%d domainls=%s pos=%s" % \
155  (self.plane, self.region, self.domainls, self.pos)
156  if self.impact is not None:
157  blah += " impact=%f" % self.impact
158  blah += ">"
159  return blah
160 
161 
def wirecell.sigproc.response.ResponseFunction.asdict (   self)
Object as a dictionary.

Definition at line 127 of file __init__.py.

127  def asdict(self):
128  '''
129  Object as a dictionary.
130  '''
131  return dict(plane=self.plane, region=self.region, pos=self.pos,
132  domainls=self.domainls, response=self.response.tolist(),
133  impact=self.impact)
134 
def wirecell.sigproc.response.ResponseFunction.dup (   self,
  kwds 
)
Return a new ResponseFunction which is a copy of this one and
with any values in kwds overriding.

Definition at line 115 of file __init__.py.

115  def dup(self, **kwds):
116  '''
117  Return a new ResponseFunction which is a copy of this one and
118  with any values in kwds overriding.
119  '''
120  return ResponseFunction(**dict(self.asdict, **kwds))
121 
def wirecell.sigproc.response.ResponseFunction.nbins (   self)

Definition at line 123 of file __init__.py.

def wirecell.sigproc.response.ResponseFunction.resample (   self,
  nbins 
)

Definition at line 109 of file __init__.py.

109  def resample(self, nbins):
110  newls = (self.times[0], self.times[-1], nbins)
111  newtimes = numpy.linspace(*newls)
112  newresps = numpy.interp(newtimes, self.times, self.response)
113  return self.dup(domainls=newls, response=newresps)
114 
def wirecell.sigproc.response.ResponseFunction.shaped (   self,
  gain = 14*units.mV/units.fC,
  shaping = 2.0*units.us,
  nbins = None 
)
Convolve electronics shaping/peaking response, returning a new
ResponseFunction.

Definition at line 135 of file __init__.py.

135  def shaped(self, gain=14*units.mV/units.fC, shaping=2.0*units.us, nbins=None):
136  '''
137  Convolve electronics shaping/peaking response, returning a new
138  ResponseFunction.
139  '''
140  # use version defined above
141  # from scipy.signal import fftconvolve
142  if nbins is None:
143  newfr = self.dup()
144  else:
145  newfr = self.resample(nbins)
146  # integrate the current over the sample to get charge
147  dt = newfr.times[1]-newfr.times[0]
148  newfr.response = [r*dt for r in newfr.response]
149  elecr = electronics(newfr.times, gain, shaping)
150  newfr.response = convolve(elecr, newfr.response)
151  return newfr
152 
def shaped(self, gain=14 *units.mV/units.fC, shaping=2.0 *units.us, nbins=None)
Definition: __init__.py:135
def convolve(f1, f2)
Definition: __init__.py:66

Member Data Documentation

wirecell.sigproc.response.ResponseFunction.domainls

Definition at line 100 of file __init__.py.

wirecell.sigproc.response.ResponseFunction.impact

Definition at line 103 of file __init__.py.

wirecell.sigproc.response.ResponseFunction.plane

Definition at line 97 of file __init__.py.

wirecell.sigproc.response.ResponseFunction.pos

Definition at line 99 of file __init__.py.

wirecell.sigproc.response.ResponseFunction.region

Definition at line 98 of file __init__.py.

wirecell.sigproc.response.ResponseFunction.response

Definition at line 101 of file __init__.py.

wirecell.sigproc.response.ResponseFunction.times

Definition at line 102 of file __init__.py.


The documentation for this class was generated from the following file: