*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 59310fb7 authored by Schabbauer, Johannes's avatar Schabbauer, Johannes
Browse files

ADwin: Enabled keeping final AO values after shot

parent 8297ed4a
No related branches found
No related tags found
No related merge requests found
......@@ -89,17 +89,17 @@ class ADwinProIIWorker(Worker):
def get_final_values(self,f):
group = f[f"devices/{self.device_name}"]
final_values = {}
# AO_channel_map = {}
AO_channel_map = {}
for module_address,module in self.modules.items():
module_props = self.module_props[module_address]
if module_props.get("num_AO",None) is not None:
# Set all final AO values to zero
# This is done for two reasons: first in the current ADwin process all AO are set to 0 at the end,
# second if some channels are not defined in labscript (and not in the h5file), we still get a front panel value of 0.
final_values.update({f"{module_address}/{i+1}":0 for i in range(module_props["num_AO"])})
# final_values.update({f"{module_address}/{i+1}":0 for i in range(module_props["num_AO"])})
# For mapping (16) AO ADwin channels to format "module/channel", only needed if final lines in this function are uncommented
# idx_AO8 = module_props["start_index"]
# AO_channel_map.update({ i+idx_AO8 : f"{module_address}/{i}" for i in range(1,1+module_props["num_AO"])})
idx_AO8 = module_props["start_index"]
AO_channel_map.update({ i+idx_AO8 : f"{module_address}/{i}" for i in range(1,1+module_props["num_AO"])})
if module_props.get("num_DO",None) is not None:
# Confusing way to get list of 32 bools from uint32 number:
......@@ -110,11 +110,11 @@ class ADwinProIIWorker(Worker):
final_values.update({f"{module_address}/{i}":bits[int(i)-1] for i in module_props["DO_ports"]})
# TODO: only get final AO values, if we don't set then zo zero at end of ADwin process
# stop_time_quantized = np.round(self.stop_time * CLOCK_T12 / self.PROCESSDELAY)
# AO_data = group["ANALOG_OUT/VALUES"]
# final_indices = np.nonzero(AO_data["n_cycles"] == stop_time_quantized)[0]
# for idx in final_indices:
# final_values[AO_channel_map[AO_data["channel"][idx]]] = DAC(AO_data["value"][idx])
stop_time_quantized = np.round(self.stop_time * CLOCK_T12 / self.PROCESSDELAY)
AO_data = group["ANALOG_OUT/VALUES"]
final_indices = np.nonzero(AO_data["n_cycles"] == stop_time_quantized)[0]
for idx in final_indices:
final_values[AO_channel_map[AO_data["channel"][idx]]] = DAC(AO_data["value"][idx])
return final_values
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment