From 7afe85fcb0304376a76f3a0ff6f890f40dc6712b Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Tue, 11 Oct 2011 20:17:41 -0400 Subject: Stop returning the pdf probabilities and put the hit/not hit back into the likelihood. --- chroma/likelihood.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chroma/likelihood.py b/chroma/likelihood.py index 93a95c3..22398e3 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])[1:].sum() - hit_channel_prob_uncert = ( (ntotal * hit_prob * (1.0 - hit_prob)) / hit_prob**2 ).sum()**0.5 + hit_channel_prob = np.log(hit_prob[self.event.channels.hit]).sum() + np.log(1.0-hit_prob[~self.event.channels.hit]).sum() 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, pdf_prob + return -log_likelihood def setup_kernel(self, vertex_generator, nevals, nreps, ndaq, oversample_factor): bandwidth_generator = islice(vertex_generator, nevals*oversample_factor) -- cgit