diff --git a/TimeBaseAOMDriver/blacs_workers.py b/TimeBaseAOMDriver/blacs_workers.py index bc54d821e7e31d34645f6ec8edee3a14e36786d8..31679e8222422da67b31b3560b70d32d159c91a2 100644 --- a/TimeBaseAOMDriver/blacs_workers.py +++ b/TimeBaseAOMDriver/blacs_workers.py @@ -33,25 +33,18 @@ class TimeBaseWorker(Worker): with h5py.File(h5file,"r") as file: group = file[f"devices/{device_name}"] for channel in group: + any_changed = False for attr,value in group[channel].attrs.items(): if self.smart_cache[channel].get(attr) != group[channel].attrs[attr] or fresh: - # Disable sweep mode, if it was in use. - # This is necessary is update the sweep mode parameters. - if self.smart_cache[channel].get("Sswpm") != 0: - print(f"Programming {channel}, Sswpm=0") - self.client.send(f"{channel}|Sswpm:0\r\n".encode()) - self.smart_cache[channel]["Sswpm"] = 0 - time.sleep(0.01) - if attr == "Sswpm": - # Skip sweep mode, becasue I want to enable it only after - # setting all other values - continue + any_changed = True print(f"Programming {channel}, {attr}") self.client.send(f"{channel}|{attr}:{value:.0f}\r\n".encode()) self.smart_cache[channel][attr] = group[channel].attrs[attr] time.sleep(0.01) # TODO: What's the best time here? Do we need to wait at all? According to the DIM-3000 manual the rate is 10 commands per second, it seems router can also handle faster times? - # Program actual value of sweep mode - if group[channel].attrs["Sswpm"] != 0: + if group[channel].attrs["Sswpm"] != 0 and any_changed: + # Set the value of sweep mode (again) + # This has to be done after changing any of the sweep parameters. + # For simplicity I do that if any parameter was programmed. print(f"Programming {channel}, Sswpm") self.client.send(f"{channel}|Sswpm:{group[channel].attrs['Sswpm']}\r\n".encode()) self.smart_cache[channel]["Sswpm"] = {group[channel].attrs['Sswpm']} diff --git a/TimeBaseAOMDriver/labscript_devices.py b/TimeBaseAOMDriver/labscript_devices.py index 72878506587e35826041692c860ccf63642de3ba..f50fc5f8bffad8b19c2a889c221fb9fed033d183 100644 --- a/TimeBaseAOMDriver/labscript_devices.py +++ b/TimeBaseAOMDriver/labscript_devices.py @@ -159,8 +159,6 @@ class TimeBaseAOMDriver(Device): if command=="Sampl": # Amplitude has to be programmed in 0.1*dBm AOM_group.attrs[command] = np.round(10*output.static_value).astype(np.int32) - AOM_group.attrs["Sfampl"] =np.round(10*output.static_value).astype(np.int32) - else: AOM_group.attrs[command] = np.round(output.static_value).astype(np.int32)