diff options
author | Stan Seibert <stan@mtrr.org> | 2011-10-11 20:17:41 -0400 |
---|---|---|
committer | Stan Seibert <stan@mtrr.org> | 2011-10-11 20:17:41 -0400 |
commit | 7afe85fcb0304376a76f3a0ff6f890f40dc6712b (patch) | |
tree | c07d7ba2480cbeb1d07a790210d1ba24d829fedd | |
parent | 2a670f4eaf8ab2430f0ba7918a07794e60d73045 (diff) | |
download | chroma-7afe85fcb0304376a76f3a0ff6f890f40dc6712b.tar.gz chroma-7afe85fcb0304376a76f3a0ff6f890f40dc6712b.tar.bz2 chroma-7afe85fcb0304376a76f3a0ff6f890f40dc6712b.zip |
Stop returning the pdf probabilities and put the hit/not hit back into
the likelihood.
-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 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) |