Skip to content

Commit

Permalink
examples/histograms: convert to mutate_dataset API. Closes #459
Browse files Browse the repository at this point in the history
sbourdeauducq committed Jun 1, 2016
1 parent 5b0f963 commit 9ec142e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions artiq/examples/master/repository/histograms.py
Original file line number Diff line number Diff line change
@@ -17,16 +17,15 @@ def run(self):

xs = np.empty(npoints)
xs.fill(np.nan)
xs = self.set_dataset("hd_xs", xs,
broadcast=True, save=False)
self.set_dataset("hd_xs", xs,
broadcast=True, save=False)

counts = np.empty((npoints, nbins))
counts = self.set_dataset("hd_counts", counts,
broadcast=True, save=False)
self.set_dataset("hd_counts", np.empty((npoints, nbins)),
broadcast=True, save=False)

for i in range(npoints):
histogram, _ = np.histogram(np.random.normal(i, size=1000),
bin_boundaries)
counts[i] = histogram
xs[i] = i % 8
self.mutate_dataset("hd_counts", i, histogram)
self.mutate_dataset("hd_xs", i, i % 8)
sleep(0.3)

0 comments on commit 9ec142e

Please sign in to comment.