Skip to content

Commit c5ddccd

Browse files
committed
Add proper docstring to function with wrong assert
1 parent b187e46 commit c5ddccd

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

qupulse/program/linspace.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,23 @@ class DepState:
327327
iterations: Tuple[int, ...]
328328

329329
def required_increment_from(self, previous: 'DepState', factors: Sequence[float]) -> float:
330-
assert len(self.iterations) == len(factors)
331-
assert len(self.iterations) == len(previous.iterations) or all(factor == 0
332-
for factor in factors[len(previous.iterations):])
330+
"""Calculate the required increment from the previous state to the current given the factors that determine
331+
the voltage dependency of each index.
332+
333+
By convention there are only two possible values for each iteration index integer in self: 0 or the last index
334+
The three possible increments for each iteration are none, regular and jump to next line.
335+
336+
The previous dependency state can have a different iteration length if the trailing factors now or during the
337+
last iteration are zero.
338+
339+
Args:
340+
previous: The previous state to calculate the required increment from. It has to belong to the same DepKey.
341+
factors: The number of factors has to be the same as the current number of iterations.
333342
343+
Returns:
344+
The increment
345+
"""
346+
assert len(self.iterations) == len(factors)
334347

335348
increment = self.base - previous.base
336349
for old, new, factor in zip(previous.iterations, self.iterations, factors):

0 commit comments

Comments
 (0)