diff --git a/qupulse/program/linspace.py b/qupulse/program/linspace.py index 43d01113..c1520208 100644 --- a/qupulse/program/linspace.py +++ b/qupulse/program/linspace.py @@ -341,7 +341,7 @@ def _add_iteration_node(self, node: LinSpaceIter): self.add_node(node.body) if node.length > 1: - self.iterations[-1] = node.length + self.iterations[-1] = node.length - 1 label, jmp = self.new_loop(node.length - 1) self.commands.append(label) self.add_node(node.body) diff --git a/tests/program/linspace_tests.py b/tests/program/linspace_tests.py index 03a5b297..60acd136 100644 --- a/tests/program/linspace_tests.py +++ b/tests/program/linspace_tests.py @@ -74,7 +74,7 @@ def setUp(self): LoopLabel(1, 99), - Increment(0, -2.0, key_0), + Increment(0, -1.99, key_0), Increment(1, 0.02, key_1), Wait(TimeType(10 ** 6)), @@ -131,8 +131,8 @@ def setUp(self): LoopLabel(1, 99), - Increment(0, 1e-3 + -200 * 1e-2, key_0), - Increment(1, 0.02 + -200 * -3e-3, key_1), + Increment(0, 1e-3 + -199 * 1e-2, key_0), + Increment(1, 0.02 + -199 * -3e-3, key_1), Wait(TimeType(10 ** 6)), LoopLabel(2, 199), @@ -223,7 +223,7 @@ def setUp(self): Set(0, -0.4), Set(1, -0.3), Wait(TimeType(10 ** 5)), - Increment(0, -2.0, key_0), + Increment(0, -1.99, key_0), Increment(1, 0.02, key_1), Wait(TimeType(10 ** 6)), Set(0, 0.05),