stoner_measurement.plugins.command.reconfigure.ReconfigureCommand

class stoner_measurement.plugins.command.reconfigure.ReconfigureCommand(parent=None)[source]

Bases: CommandPlugin

Connect and configure the checked sequence instances at runtime.

By default selected instances skip startup setup; disable suppression to retain it. Every execution safely reconnects and reapplies configuration, including loop iterations. Commands without an instrument lifecycle can be selected but need no setup.

Use this command after changing settings or before a measurement whose setup must be delayed. On General, tick the required sequence instances and choose Suppress connect and configure at startup (enabled by default). Checked, active targets are reconnected and configured in sequence order. A target must reach this setup step before an action that requires it to be ready, including inside conditional branches and loops.

The target’s inherited delay_configuration flag is derived from these selections; do not edit or save it independently. Reconnection releases the target’s previous resources first. Missing targets and setup failures stop execution with an error. The command publishes no measurement data.

Variables:
  • target_names (list[str]) – Selected sequence-instance names.

  • suppress_startup_setup (bool) – Skip startup setup for selected targets; defaults to True.

  • instance_name (str) – Inherited Python identifier for this instance in the Script tab and QtConsole.

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

  • sequence_engine (SequenceEngine | None) – Inherited owning engine and its live namespace; None while detached.

Keyword Parameters:

parent (QObject | None) – Optional Qt parent object.

Examples

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

reconfigure.target_names = ["k6221_dc_iv"]
reconfigure.suppress_startup_setup = True
bind_sequence_plugins(plugins: list[BasePlugin], active_plugins: list[BasePlugin] | None = None, known_names: list[str] | None = None) → None[source]

Bind actual instances, including in standalone generated scripts.

config_widget(parent: QWidget | None = None) → QWidget[source]

Show a flat, checkable list of sequence instances.

execute() → None[source]

Resolve selected instances, then apply setup in sequence order.

property name: str

Unique human-readable name for this plugin.

property suppress_startup_setup: bool

Whether checked targets skip their normal startup setup.

property target_names: list[str]

Return the selected instance names.

to_json() → dict[str, Any][source]

Serialise this plugin’s configuration to a JSON-compatible dict.

The returned dict contains at minimum:

  • "type" — the plugin sub-type tag (e.g. "trace", "state").

  • "class" — the fully qualified class path "module:ClassName" used by from_json() to reconstruct the exact subclass.

  • "instance_name" — the current instance_name.

Subclasses should call super().to_json() and then add their own configuration keys to the returned dict.

Returns:

A JSON-serialisable dictionary representing this plugin’s current configuration.

Return type:

(dict[str, Any])

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.trace import DummyPlugin
>>> plugin = DummyPlugin()
>>> d = plugin.to_json()
>>> d["type"]
'trace'
>>> d["instance_name"]
'dummy'
>>> "class" in d
True