summaryrefslogtreecommitdiff
path: root/threadtest.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-06-19 18:29:27 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-06-19 18:29:27 -0400
commita149f96a766c4d8d63919535cc468c539036165e (patch)
treefa6eece7b811e098e58fc4aa53d97a8c3dc1885e /threadtest.py
parentad56515169bab5f069344e960d9582412c3672f4 (diff)
downloadchroma-a149f96a766c4d8d63919535cc468c539036165e.tar.gz
chroma-a149f96a766c4d8d63919535cc468c539036165e.tar.bz2
chroma-a149f96a766c4d8d63919535cc468c539036165e.zip
reverse the face orientation on all triangles in the stl files exported from sketchup.
Diffstat (limited to 'threadtest.py')
-rw-r--r--threadtest.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/threadtest.py b/threadtest.py
index 81b6d62..91a1857 100644
--- a/threadtest.py
+++ b/threadtest.py
@@ -11,7 +11,7 @@ from histogram import Histogram
jobs = Queue()
output = Queue()
-def create_job(position=(0,0,0), nphotons=10000, max_steps=10):
+def create_job(position=(0,0,0), nphotons=1000, max_steps=10):
positions = np.tile(position, nphotons).reshape((nphotons, 3))
directions = uniform_sphere(nphotons)
polarizations = uniform_sphere(nphotons)
@@ -23,7 +23,7 @@ def create_job(position=(0,0,0), nphotons=10000, max_steps=10):
return Job(positions, directions, wavelengths, polarizations, times,
states, last_hit_triangles, max_steps)
-def generate_event(position=(0,0,0), nphotons=10000):
+def generate_event(position=(0,0,0), nphotons=1000):
jobs.put(create_job(position, nphotons))
jobs.join()
@@ -34,6 +34,9 @@ def generate_event(position=(0,0,0), nphotons=10000):
solids[last_hit_triangles == -1] = -1
surface_absorbed = job.states == 2
+ for i in np.unique(job.states):
+ print 'state %2i %i' % (i, len(job.states[job.states == i]))
+
event_times = []
for i in lbne.pmtids:
photons = np.logical_and(solids == i, surface_absorbed)
@@ -43,12 +46,11 @@ def generate_event(position=(0,0,0), nphotons=10000):
if len(hit_times) > 0:
event_times.append((i, np.min(hit_times)))
- print len(event_times)
- print event_times
+ print '%i hit pmts' % len(event_times)
return event_times
-def likelihood(event_times, position=(0,0,0), nphotons=10000, neval=100):
+def likelihood(event_times, position=(0,0,0), nphotons=1000, neval=100):
for i in range(neval):
jobs.put(create_job(position, nphotons))
jobs.join()