From bb3ea07ebdb0720cf94d12db4602e4dd2d46fe78 Mon Sep 17 00:00:00 2001 From: Graham Rowlands Date: Mon, 11 May 2020 22:12:01 -0400 Subject: [PATCH] WIP: update wf library command for aps2 binary format --- QGL/drivers/APS2Pattern.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/QGL/drivers/APS2Pattern.py b/QGL/drivers/APS2Pattern.py index 8b2c1633..605acd5a 100644 --- a/QGL/drivers/APS2Pattern.py +++ b/QGL/drivers/APS2Pattern.py @@ -1277,12 +1277,31 @@ def start_new_seq(): def update_wf_library(filename, pulses, offsets): """ - Update a H5 waveform library in place give an iterable of (pulseName, pulse) + Update an aps2 waveform library in place give an iterable of (pulseName, pulse) tuples and offsets into the waveform library. """ assert USE_PHASE_OFFSET_INSTRUCTION == False - #load the h5 file - with h5py.File(filename) as FID: + #load the waveform file + with open(fileName, 'wb') as FID: + + # Find the necessary offsets into the file + target_hw = FID.read(4).decode('utf-8') + if target_hw != "APS2": + raise Exception("Cannot update non-APS2 waveform library.") + + file_version = struct.unpack('