forked from M-Labs/artiq
1
0
Fork 0

examples/histograms: convert to mutate_dataset API. Closes #459

This commit is contained in:
Sebastien Bourdeauducq 2016-05-31 20:24:46 -05:00
parent 5b0f963b98
commit 9ec142e4f6
1 changed files with 6 additions and 7 deletions

View File

@ -17,16 +17,15 @@ class Histograms(EnvExperiment):
xs = np.empty(npoints) xs = np.empty(npoints)
xs.fill(np.nan) xs.fill(np.nan)
xs = self.set_dataset("hd_xs", xs, self.set_dataset("hd_xs", xs,
broadcast=True, save=False) broadcast=True, save=False)
counts = np.empty((npoints, nbins)) self.set_dataset("hd_counts", np.empty((npoints, nbins)),
counts = self.set_dataset("hd_counts", counts, broadcast=True, save=False)
broadcast=True, save=False)
for i in range(npoints): for i in range(npoints):
histogram, _ = np.histogram(np.random.normal(i, size=1000), histogram, _ = np.histogram(np.random.normal(i, size=1000),
bin_boundaries) bin_boundaries)
counts[i] = histogram self.mutate_dataset("hd_counts", i, histogram)
xs[i] = i % 8 self.mutate_dataset("hd_xs", i, i % 8)
sleep(0.3) sleep(0.3)