forked from M-Labs/artiq
1
0
Fork 0

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 n = self.nbins-1
hist[n] += 1 hist[n] += 1
for i in range(self.nbins): print(hist)
print(i, hist[i])

View File

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