From bec629d6cb050164dc3b96c832a5e25f6840f754 Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Thu, 8 Sep 2011 11:31:28 -0400 Subject: Make water the default material for the SNO detector --- detectors/sno.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/detectors/sno.py b/detectors/sno.py index d0334d3..d5c9ce9 100644 --- a/detectors/sno.py +++ b/detectors/sno.py @@ -75,16 +75,17 @@ def build_sno(real_av=False): pmt = build_8inch_pmt_with_lc() - geo = Geometry() if real_av: + geo = Geometry(water) real_av_mesh = mesh_from_stl(dir+'/sno_av_ascii.stl.bz2') real_av_mesh.vertices *= 0.0254 # inch -> meter geo.add_solid(Solid(real_av_mesh, glass, water, color=0xBBAAAAFF)) else: + geo = Geometry(water) geo.add_solid(Solid(av_outside_mesh, acrylic_sno, water, color=0xBBFFFFFF)) - geo.add_solid(Solid(av_inside_mesh, labppo_scintillator, acrylic_sno, + geo.add_solid(Solid(av_inside_mesh, water, acrylic_sno, color=0xBB0000FF)) geo.pmtids = [] -- cgit From aeb16cf530767cd16c23c258802325b726e577d7 Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Thu, 8 Sep 2011 11:32:56 -0400 Subject: Prevent progress() from raising an exception if you pass in a sequence with less than 10 elements --- tools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools.py b/tools.py index d6b71b1..a884db3 100644 --- a/tools.py +++ b/tools.py @@ -13,8 +13,9 @@ def progress(seq): n = len(seq) print '[' + ' '*21 + ']\r[', sys.stdout.flush() + update_interval = max(n // 10, 1) for i, item in enumerate(seq): - if i % (n//10) == 0: + if i % update_interval == 0: print '.', sys.stdout.flush() yield item -- cgit From 7cae8c3b343d1bde0320ff2ea224cc1ef79889df Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Thu, 8 Sep 2011 11:36:52 -0400 Subject: repeating_iterator needs a number of reps --- sim.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sim.py b/sim.py index 931858f..26835f9 100755 --- a/sim.py +++ b/sim.py @@ -110,7 +110,7 @@ class Simulation(object): self.gpu_pdf.clear_pdf() if nreps > 1: - iterable = repeating_iterator(iterable) + iterable = repeating_iterator(iterable, nreps) for ev in iterable: gpu_photons = gpu.GPUPhotons(ev.photons_beg) @@ -139,7 +139,7 @@ class Simulation(object): iterable = self.photon_generator.generate_events(iterable) if nreps > 1: - iterable = repeating_iterator(iterable) + iterable = repeating_iterator(iterable, nreps) for ev in iterable: gpu_photons = gpu.GPUPhotons(ev.photons_beg) -- cgit