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

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

Write index instead of time in hdf5 for Spectrum card

parent ee454385
No related branches found
No related tags found
1 merge request!2Added new spectrum awg card.
......@@ -69,10 +69,10 @@ class SpectrumAWGWorker(Worker):
self.smart_cache = {}
last_index = len(group[ch].attrs)-1
times = np.sort(np.array(group[ch].attrs).astype(np.float32)) # The attribute names are strings and sorted wrong. TODO: better perfomance without sorting here?
for index,t in enumerate(times):
for index in range(len(group[ch].attrs)):
index_h5 = str(index) # The index in the h5 file is a str
### LOOP TROUGH STREAMING STEPS ###
instruction = group[ch].attrs[t]
instruction = group[ch].attrs[index_h5]
instruction_hash = hash(instruction.tobytes())
if instruction_hash in self.smart_cache:
memory_index = self.smart_cache[instruction_hash]
......@@ -95,8 +95,8 @@ class SpectrumAWGWorker(Worker):
initial_values[memory_index] = f"f:{freq}, a:{ampl}, p:{phase}"
else:
raise RuntimeError("Instruction length does not match, what happened??")
if t in group[ch]["labels"].attrs:
initial_values[memory_index] = group[ch]["labels"].attrs[t]
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:
self.AWG.seq_set_sequence_step(index,memory_index,index+1,1,'on_trigger',last_step=False)
......
......@@ -168,10 +168,10 @@ class SpectrumAWG(Device):
group.require_group(output.connection)
group[output.connection].require_group("labels")
for t in change_times:
group[output.connection].attrs[str(t)] = output.instructions[t][:-1]
for i,t in enumerate(np.sort(change_times)):
group[output.connection].attrs[str(i)] = output.instructions[t][:-1]
if output.instructions[t][-1] is not None:
group[output.connection]["labels"].attrs[str(t)] = output.instructions[t][-1]
group[output.connection]["labels"].attrs[str(i)] = output.instructions[t][-1]
......
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