Skip to content

Commit

Permalink
Append to measurements before running simulation
Browse files Browse the repository at this point in the history
This way, the data is saved if an exception occurs.
  • Loading branch information
eliasrg committed Sep 26, 2017
1 parent f96b287 commit fed0259
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def simulate(params=params, get_noise_record=lambda: None, plots=False):
for i in range(n_runs):
sim = Simulation(params, get_noise_record())
measurement = Measurement(params)
measurements.append(measurement)
if plots:
tracker = sim.encoder.get_tracker()
plot_lloyd_max(tracker.distr,
Expand All @@ -80,7 +81,6 @@ def simulate(params=params, get_noise_record=lambda: None, plots=False):
print("Run {:d}, t = {:d} done".format(i, t))
except KeyboardInterrupt:
print("Keyboard interrupt!")
measurements.append(measurement)

print(" Average power over channel: {:.4f}".format(
sim.channel.average_power()))
Expand Down

0 comments on commit fed0259

Please sign in to comment.