examples: use new features

This commit is contained in:
Sebastien Bourdeauducq 2014-12-19 15:20:19 +08:00
parent 5d40c2431e
commit eeb2790243
2 changed files with 3 additions and 7 deletions

View File

@ -31,5 +31,4 @@ class PhotonHistogram(AutoContext):
n = self.nbins-1
hist[n] += 1
for i in range(self.nbins):
print(i, hist[i])
print(hist)

View File

@ -94,16 +94,13 @@ class Transport(AutoContext):
@kernel
def repeat(self):
hist = [0 for _ in range(self.nbins)]
self.histogram = [0 for _ in range(self.nbins)]
for i in range(self.repeats):
n = self.one()
if n >= self.nbins:
n = self.nbins-1
hist[n] += 1
for i in range(self.nbins):
self.histogram.append(hist[i])
self.histogram[n] += 1
def scan(self, stops):
for s in stops: