From 87eddeeec7da7a16640b2269c6738749803fb717 Mon Sep 17 00:00:00 2001 From: Runner PC Cavity Lab <johannes.schabbauer@tuwien.ac.at> Date: Fri, 27 Sep 2024 10:53:29 +0200 Subject: [PATCH] Added error check when sample size is too small (rounded down to 0) --- SpectrumAWG/labscript_devices.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SpectrumAWG/labscript_devices.py b/SpectrumAWG/labscript_devices.py index 4ea4fde..4dd1524 100644 --- a/SpectrumAWG/labscript_devices.py +++ b/SpectrumAWG/labscript_devices.py @@ -110,7 +110,9 @@ class AWGOutput(Output): def do_checks(self): for t,instruction in self.instructions.items(): if instruction[0]>self.parent_device.max_sample_size: - raise LabscriptError(f"Instruction for '{self.name}' at t={t} has too many samples (num_samples={instruction[0]:.0f}).") + raise LabscriptError(f"Instruction for '{self.name}' at t={t} has too many samples (num_samples={instruction[0]:.0f}). The maximum is {self.parent_device.max_sample_size} with your settings.") + elif instruction[0] <= 0: + raise LabscriptError(f"Instruction for '{self.name}' at t={t} has too short sample length. The minimum is {4096/self.parent_device.sample_rate*1e9}ns.") @@ -150,7 +152,7 @@ class SpectrumAWG(Device): # Calculate maximal sample size internal_memory = 2**32 # 4GB - self.max_sample_size = internal_memory//2//memory_segments # TODO: according to the messages in the worker we don't need the factor 2 here + self.max_sample_size = internal_memory//2//memory_segments def do_checks(self): if len(self.child_devices)>1: -- GitLab