From 43fc30e025639761f66bb44ffaf22c3a7dc9c3c9 Mon Sep 17 00:00:00 2001 From: Graham Rowlands Date: Fri, 17 Aug 2018 11:30:51 -0400 Subject: [PATCH] Ensure APS2 files with no waveforms still have the waveform group written. --- QGL/drivers/APS2Pattern.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/QGL/drivers/APS2Pattern.py b/QGL/drivers/APS2Pattern.py index fb9f00ba..64dd96c1 100644 --- a/QGL/drivers/APS2Pattern.py +++ b/QGL/drivers/APS2Pattern.py @@ -1096,7 +1096,14 @@ def write_sequence_file(awgData, fileName): chanStr = '/chan_{0}'.format(chanct + 1) chanGroup = FID.create_group(chanStr) #Write the waveformLib to file - FID.create_dataset(chanStr + '/waveforms', data=wfInfo[chanct][0]) + if wfInfo[chanct][0].size == 0: + #If there are no waveforms, ensure that there is some element + #so that the waveform group gets written to file. + #TODO: Fix this in libaps2 + data = np.array([0], dtype=np.uint16) + else: + data = wfInfo[chanct][0] + FID.create_dataset(chanStr + '/waveforms', data=data) #Write the instructions to channel 1 if np.mod(chanct, 2) == 0: