stoner_measurement.plugins.state_sweep.motor_controller.MotorControllerSweepPlugin

class stoner_measurement.plugins.state_sweep.motor_controller.MotorControllerSweepPlugin(parent=None)[source]

Bases: MotorControllerPluginMixin, StateSweepPlugin

Sweep the motor angle continuously while collecting data in motion.

Use this plugin when you want a rotation stage or motor axis to move continuously and your measurement sub-sequence to run repeatedly while the angle is changing. This is useful for angular sweeps where stopping at every point would be unnecessarily slow.

The Sweep tab selects a multi-segment ramp or monitor-and-filter generator. A multi-segment ramp defines an optional starting angle and a sequence of absolute targets, angular rates, and measurement flags. Once motion begins, the plugin samples the live angle and runs nested steps at the generator’s polling interval without stopping the motor. Segment rates are interpreted in degrees per second. Start from current value skips the initial positioning move.

The Sweep tab also controls the timeout factor and optional temporary motor-engine polling rate. The timeout is the generator’s estimated duration multiplied by the configured factor, which defaults to 2.0; the previous engine polling rate is restored when the sweep exits. The Settings tab controls acceleration, move direction, and which measured angle, target-angle, and angular-rate outputs are published. Motion rates come from the sweep segments, so there is no separate fixed-velocity control. The Data tab selects values recorded during motion.

The plugin connects the application’s preferred controller through the shared motor engine when necessary. Completing or aborting the sweep restores temporary polling configuration and leaves the shared engine connected. It does not automatically return the motor home.

Variables:
  • sweep_timeout_factor (float) – Multiplier applied to the estimated sweep duration when computing the allowed wall-clock runtime.

  • default_sweep_timeout_factor (float) – Default timeout multiplier for motor sweeps. This plugin uses 2.0.

  • sweep_rate_time_scale_seconds (float) – Time-scale factor used to interpret sweep rates. This plugin uses 1.0 so that configured ramp rates are treated as deg/s.

  • sweep_generator (BaseSweepGenerator) – Active sweep generator instance controlling the angular trajectory.

  • acceleration (float | str) – Acceleration or sequence expression in degrees per second squared.

  • direction (MotorMoveDirection) – Direction policy used for initial and segment target moves.

  • report_outputs (list[str] | None) – Optional motor readbacks exposed to the sequence value catalogue.

  • value (float) – Most recently sampled control value, in degrees.

  • ix (int) – Index of the most recently yielded sweep point.

  • 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.

  • meas_flag (bool) – Inherited flag indicating a measurement point.

  • collect_data (bool) – Inherited switch enabling collection of selected sequence outputs.

  • data (TraceData) – Inherited accumulated table; inspect data.df after collection.

Keyword Parameters:

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

Examples

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

motor_controller_sweep.sweep_timeout_factor = 3.0
motor_controller_sweep.collect_data = True
motor_controller_sweep.data.df.head()
configure() → None

Push the configured velocity and acceleration into the engine.

connect() → None

Ensure that a shared motor-controller engine is available.

disconnect() → None

Leave the shared engine running.

property name: str

Unique human-readable name for this plugin.

property state_name: str

Human-readable name for the swept state.

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

Serialise this plugin’s configuration, including the sweep generator.

Extends to_json() with "sweep_generator" and "sweep_timeout_factor" keys.

Returns:

JSON-serialisable dictionary with all plugin keys.

Return type:

(dict[str, Any])

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.state_sweep import SweepTimePlugin
>>> d = SweepTimePlugin().to_json()
>>> d["type"]
'state_sweep'
>>> "sweep_generator" in d
True
>>> d["sweep_timeout_factor"]
2.0
property units: str

Physical units for the swept state.