summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-10-08 16:31:58 -0400
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:10 -0700
commitbbeb34705761f293e3d1f85c4b145221306b2b5c (patch)
treee3aaa1d30823547a1336479da7033180c1e31965
parent7afe85fcb0304376a76f3a0ff6f890f40dc6712b (diff)
downloadchroma-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.
-rw-r--r--chroma/__init__.py2
-rw-r--r--chroma/camera.py10
-rw-r--r--chroma/likelihood.py10
3 files changed, 7 insertions, 15 deletions
diff --git a/chroma/__init__.py b/chroma/__init__.py
index 6712470..dd7e323 100644
--- a/chroma/__init__.py
+++ b/chroma/__init__.py
@@ -3,7 +3,6 @@ from chroma import geometry
from chroma import event
from chroma.io import root
from chroma import generator
-from chroma.generator import constant_particle_gun
from chroma import gpu
from chroma import itertoolset
from chroma import likelihood
@@ -12,6 +11,5 @@ from chroma.demo import optics
from chroma import project
from chroma import sample
from chroma.sim import Simulation
-from chroma.likelihood import Likelihood
from chroma.stl import mesh_from_stl
from chroma import transform
diff --git a/chroma/camera.py b/chroma/camera.py
index 302bc6f..74ac4ad 100644
--- a/chroma/camera.py
+++ b/chroma/camera.py
@@ -706,14 +706,8 @@ class EventViewer(Camera):
q = self.ev.channels.q
# Important: Compute range only with HIT channels
- channel_color = map_to_color(q, range=(q[hit].min(),q[hit].max()))
- solid_hit = np.zeros(len(self.geometry.mesh.triangles), dtype=np.bool)
- solid_color = np.zeros(len(self.geometry.mesh.triangles), dtype=np.uint32)
-
- solid_hit[self.geometry.channel_index_to_solid_id] = hit
- solid_color[self.geometry.channel_index_to_solid_id] = channel_color
-
- self.gpu_geometry.color_solids(solid_hit, solid_color)
+ solid_colors = map_to_color(q, range=(q[hit].min(),q[hit].max()))
+ self.gpu_geometry.color_solids(hit, solid_colors)
def process_event(self, event):
if event.type == KEYDOWN:
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)