LinspaceLoop

class caqtus.types.iteration.LinspaceLoop(
sub_steps: list[TypeAliasForwardRef('Step')],
variable: DottedVariableName,
start: Expression,
stop: Expression,
num,
)

Bases: ContainsSubSteps

Represents a loop that iterates between two values with a fixed number of steps.

variable

The name of the variable that is being iterated over.

Type:

caqtus.types.variable_name.DottedVariableName

start

The start value of the variable.

Type:

caqtus.types.expression._expression.Expression

stop

The stop value of the variable.

Type:

caqtus.types.expression._expression.Expression

num

The number of steps to take between the start and stop values.

Type:

int

loop_values(
evaluation_context: Mapping[DottedVariableName, Any],
) Iterator[float | Quantity[float, Unit]]

Returns the values that the variable represented by this loop takes.

Parameters:

evaluation_context – Contains the value of the variables with which to evaluate the start and stop expressions of the loop.

Raises:
  • EvaluationError – if the start or stop expressions could not be evaluated.

  • NotAnalogValueError – if the start or stop expressions don’t evaluate to an analog value.

  • DimensionalityError – if the start or stop values are not commensurate.