From 3130287e0ba0d9c7ab7f1cee7e7457e8f525789a Mon Sep 17 00:00:00 2001 From: Runner PC Cavity Lab <johannes.schabbauer@tuwien.ac.at> Date: Wed, 5 Mar 2025 17:12:19 +0100 Subject: [PATCH] Some minor fixes for tweezer occupation, AWG reprogramming and waits --- ADwinProII/blacs_workers.py | 6 +++--- ADwinProII/labscript_devices.py | 2 +- DCAMCamera/blacs_workers.py | 4 ++-- SpectrumAWG/blacs_workers.py | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ADwinProII/blacs_workers.py b/ADwinProII/blacs_workers.py index f5956cd..ef8ce38 100644 --- a/ADwinProII/blacs_workers.py +++ b/ADwinProII/blacs_workers.py @@ -143,8 +143,8 @@ class ADwinProIIWorker(Worker): # Send stop time to ADwin self.adw.Set_Par(2, int(self.stop_time * CLOCK_T12 / self.PROCESSDELAY)) # Send wait time and timeout to ADwin (default 0 if no waits) - self.adw.Set_Par(3, group.attrs.get("wait_time",-1)) - self.adw.Set_Par(5, group.attrs.get("wait_timeout",0)) + self.adw.Set_Par(3, int(group.attrs.get("wait_time",-1))) + self.adw.Set_Par(5, int(group.attrs.get("wait_timeout",0))) # Send data to ADwin AOUT = group["ANALOG_OUT/VALUES"] if fresh or not np.array_equal(AOUT[:],self.smart_cache["AOUT"]): @@ -160,7 +160,7 @@ class ADwinProIIWorker(Worker): self.smart_cache[name] = DOUT[:] self.adw.SetData_Long(DOUT["n_cycles"], module, 1, DOUT.shape[0]) self.adw.SetData_Long(DOUT["bitfield"], module+1, 1, DOUT.shape[0]) - self.adw.Set_Par(module-1, DOUT.attrs.get("wait_time",-1)) + self.adw.Set_Par(module-1, int(DOUT.attrs.get("wait_time",-1))) PIDs = group["ANALOG_OUT/PID_CHANNELS"] if fresh or not np.array_equal(PIDs[:],self.smart_cache["PIDs"]): print("PIDs programmed.") diff --git a/ADwinProII/labscript_devices.py b/ADwinProII/labscript_devices.py index f7697e7..8fddb6b 100644 --- a/ADwinProII/labscript_devices.py +++ b/ADwinProII/labscript_devices.py @@ -324,5 +324,5 @@ class ADwinProII(PseudoclockDevice): hdf5_file[f"devices/{self.name}"].attrs["wait_time"] = round(time * self._pseudoclock_T12.clock_limit) hdf5_file[f"devices/{self.name}"].attrs["wait_timeout"] = round(args[1] * self._pseudoclock_T12.clock_limit) for TiCo in self.TiCos: - hdf5_file[f"devices/{self.name}/DIGITAL_OUT/"].attrs["wait_time"] = round(time * self._pseudoclock_T12.clock_limit) + hdf5_file[f"devices/{self.name}/DIGITAL_OUT/"].attrs["wait_time"] = round(time * self.TiCos[TiCo].clock_limit) \ No newline at end of file diff --git a/DCAMCamera/blacs_workers.py b/DCAMCamera/blacs_workers.py index b5e6026..4cfd035 100644 --- a/DCAMCamera/blacs_workers.py +++ b/DCAMCamera/blacs_workers.py @@ -234,7 +234,7 @@ class DCAM_Camera(object): # Send image to occupation receiver if tweezer_socket and tweezer_img_no==i: if bright_img_no is not None: - occupation = get_occupation(images[-1]-images[bright_img_no]) + occupation = get_occupation(np.array(images[-1],dtype=np.int32)-np.array(images[bright_img_no],dtype=np.int32)) else: occupation = get_occupation(images[-1]-200) metadata = dict(dtype=str(occupation.dtype), shape=occupation.shape) @@ -243,7 +243,7 @@ class DCAM_Camera(object): print(f"Trying to send image {len(images)} to occupation receiver...", end="\r") response = tweezer_socket.recv() assert response == b'ok', response - print(f"Sent image {len(images)} to occupation receiver.") + print(f"Sent occupation for image {len(images)} to occupation receiver.") print(f"Got image {i+1} of {n_images}.") print(f"Got {len(images)} of {n_images} images.") diff --git a/SpectrumAWG/blacs_workers.py b/SpectrumAWG/blacs_workers.py index e4ff744..aba623a 100644 --- a/SpectrumAWG/blacs_workers.py +++ b/SpectrumAWG/blacs_workers.py @@ -109,12 +109,13 @@ class SpectrumAWGWorker(Worker): if index_h5 in group[ch]["labels"].attrs: initial_values[memory_index] = group[ch]["labels"].attrs[index_h5] self.AWG.transfer_sequence_replay_samples(memory_index,data) - if index!=last_index: + if index!=last_index or function_conditional_programming: self.AWG.seq_set_sequence_step(index,memory_index,index+1,1,'on_trigger',last_step=False) else: self.AWG.seq_set_sequence_step(index,memory_index,index,1,'on_trigger',last_step=False) # If there is a trigger at the stop time, repeat one last sequence - # and then stop (is not card_stop() was called already) + # and then stop (if not card_stop() was called already) + if index==last_index: self.AWG.seq_set_sequence_step(index+1,memory_index,0,1,'always',last_step=True) # ONLY IMPLEMENTED FOR ONE CHANNEL, IF TWO CHANNELS ARE NEEDED WE ALREADY GET AN ERROR IN LABSCRIPT # FOR IMPLEMENTATION ONE HASE TO INTERWEAVE THE DATA FOR BOTH CHANNELS -- GitLab