diff options
| author | Stan Seibert <stan@mtrr.org> | 2011-10-08 16:31:58 -0400 |
|---|---|---|
| committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:10 -0700 |
| commit | bbeb34705761f293e3d1f85c4b145221306b2b5c (patch) | |
| tree | e3aaa1d30823547a1336479da7033180c1e31965 /chroma/likelihood.py | |
| parent | 7afe85fcb0304376a76f3a0ff6f890f40dc6712b (diff) | |
| download | chroma-bbeb34705761f293e3d1f85c4b145221306b2b5c.tar.gz chroma-bbeb34705761f293e3d1f85c4b145221306b2b5c.tar.bz2 chroma-bbeb34705761f293e3d1f85c4b145221306b2b5c.zip | |
Initial import of Chroma from private to public repository.
Apologies for the lack of history, but Chroma's prehistory included
some very large files and possibly proprietary engineering data.
Rather than clutter up the public repository (and panic people), we
are starting fresh. All development happens here from now on.
Diffstat (limited to 'chroma/likelihood.py')
| -rw-r--r-- | chroma/likelihood.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chroma/likelihood.py b/chroma/likelihood.py index 22398e3..93a95c3 100644 --- a/chroma/likelihood.py +++ b/chroma/likelihood.py @@ -61,7 +61,7 @@ class Likelihood(object): nreps=nreps, ndaq=ndaq, time_only=self.time_only) - + # Normalize probabilities and put a floor to keep the log finite hit_prob = hitcount.astype(np.float32) / ntotal hit_prob = np.maximum(hit_prob, 0.5 / ntotal) @@ -79,10 +79,10 @@ class Likelihood(object): # NLL calculation: note that negation is at the end # Start with the probabilties of hitting (or not) the channels - hit_channel_prob = np.log(hit_prob[self.event.channels.hit]).sum() + np.log(1.0-hit_prob[~self.event.channels.hit]).sum() + hit_channel_prob = np.log(hit_prob[self.event.channels.hit]).sum() + np.log(1.0-hit_prob[~self.event.channels.hit])[1:].sum() + hit_channel_prob_uncert = ( (ntotal * hit_prob * (1.0 - hit_prob)) / hit_prob**2 ).sum()**0.5 log_likelihood = ufloat((hit_channel_prob, 0.0)) - - #log_likelihood = ufloat((0.0,0.0)) # FIXME: skipping hit/not hit probabilities for now + log_likelihood = ufloat((0.0,0.0)) # FIXME: skipping hit/not hit probabilities for now # Then include the probability densities of the observed # charges and times. @@ -90,7 +90,7 @@ class Likelihood(object): pdf_prob_uncert[self.event.channels.hit])) log_likelihood += unumpy.log(hit_pdf_ufloat).sum() - return -log_likelihood + return -log_likelihood, pdf_prob def setup_kernel(self, vertex_generator, nevals, nreps, ndaq, oversample_factor): bandwidth_generator = islice(vertex_generator, nevals*oversample_factor) |
