diff --git a/artiq/examples/master/repository/flopping_f_simulation.py b/artiq/examples/master/repository/flopping_f_simulation.py index 0315ef2d8..5f22656a6 100644 --- a/artiq/examples/master/repository/flopping_f_simulation.py +++ b/artiq/examples/master/repository/flopping_f_simulation.py @@ -57,8 +57,17 @@ class FloppingF(EnvExperiment): def analyze(self): # Use get_dataset so that analyze can be run stand-alone. - frequency = self.get_dataset("flopping_f_frequency") brightness = self.get_dataset("flopping_f_brightness") + try: + frequency = self.get_dataset("flopping_f_frequency") + except KeyError: + # Since flopping_f_frequency is not saved, it is missing if + # analyze() is run on HDF5 data. But assuming that the arguments + # have been loaded from that same HDF5 file, we can reconstruct it. + frequency = np.fromiter(self.frequency_scan, np.float) + assert frequency.shape == brightness.shape + self.set_dataset("flopping_f_frequency", frequency, + broadcast=True, save=False) popt, pcov = curve_fit(model_numpy, frequency, brightness, p0=[self.get_dataset("flopping_freq", 1500.0)])