stoner_measurement.plugins.command.loop_control.ContinueIfCommand

class stoner_measurement.plugins.command.loop_control.ContinueIfCommand(parent=None, condition: str = 'True')[source]

Bases: _ConditionalLoopControlCommand

Skip the rest of a scan or sweep iteration when a condition is true.

Use this command inside a scan or sweep when later steps in selected loop iterations should be skipped without ending the whole scan. The condition is evaluated in the live sequence namespace at the command’s position in each iteration. A true result executes Python’s continue statement, moving directly to the next point of the nearest containing scan or sweep; a false result lets the remaining steps run normally.

The configuration tab contains the standard instance-name field and a Condition editor. Enter a Python expression that uses values already available in the sequence namespace, such as a measured output or a controller state. A blank condition is stored as True. This command must remain inside a scan or sweep in the sequence tree because continue is not valid at the top level.

The command emits its conditional loop-control statement when the sequence script is generated. Calling execute() directly does nothing because loop control can only be applied by the generated code.

Variables:
  • condition (str) – Python expression evaluated before deciding whether to skip the rest of the current iteration. Defaults to "True".

  • statement (str) – Loop-control statement emitted into generated code. Always "continue" for this plugin.

  • instance_name (str) – Inherited sequence-instance name. Defaults to "continue_if".

  • sequence_engine (SequenceEngine | None) – Inherited reference to the sequence engine and its live namespace.

  • comment (str) – Inherited optional note displayed beside this step.

Keyword Parameters:
  • parent (QObject | None) – Optional Qt parent object.

  • condition (str) – Initial Python condition expression. Defaults to "True".

Examples

With an instance named continue_if in the sequence, use the QtConsole to inspect or edit it before running. Substitute your instance name if different; result data reflects completed steps:

continue_if.condition = "counter.value < minimum_value"
property name: str

Return the command’s human-readable name.

statement = 'continue'