summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2012-06-06 13:13:53 -0400
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:39 -0700
commit32a188b475e3021b7ddcaf22193fad206234cadc (patch)
tree77c6b5419e34dbbd0f81f213d9656b0fbf588d8c
parent163fbfb6875483f16a890fd3951ad1d107a35ac6 (diff)
downloadchroma-32a188b475e3021b7ddcaf22193fad206234cadc.tar.gz
chroma-32a188b475e3021b7ddcaf22193fad206234cadc.tar.bz2
chroma-32a188b475e3021b7ddcaf22193fad206234cadc.zip
Set an arbitrary time PDF for a Detector.
-rw-r--r--chroma/detector.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/chroma/detector.py b/chroma/detector.py
index f3f2d3b..dbea6df 100644
--- a/chroma/detector.py
+++ b/chroma/detector.py
@@ -120,6 +120,18 @@ class Detector(Geometry):
pdf_y = np.exp(-0.5 * (pdf_x[1:]/rms)**2)
self.time_cdf = self._pdf_to_cdf(pdf_x, pdf_y)
+ def set_time_dist(self, bin_edges, bin_contents):
+ '''Set the time PDF directly from a histogram.
+
+ `bin_edges`: array
+ bin edges of PDF. length is len(bin_contents) + 1
+ `bin_contents`: array
+ The contents of each bin in the histogram. The array
+ should not be normalized for bin width if variable bin
+ widths are present.
+ '''
+ self.time_cdf = self._pdf_to_cdf(bin_edges, bin_contents)
+
def set_charge_dist_gaussian(self, mean, rms, lo, hi, nsamples=50):
pdf_x = np.linspace(lo, hi, nsamples+1, endpoint=True)
pdf_y = np.exp(-0.5 * ((pdf_x[1:] - mean)/rms)**2)