stoner_measurement.plugins.state_scan.counter.CounterPlugin

class stoner_measurement.plugins.state_scan.counter.CounterPlugin(parent=None)[source]

Bases: StateScanPlugin

A simple hardware-free scan axis for testing and examples.

Use this plugin when you want a scan variable without connecting any real hardware. It is useful for testing sequences, trying out plotting or data collection logic, and understanding how state-scan plugins behave.

Each scan set-point is applied immediately, so there is no waiting for settling and the plugin is always considered to be at target. Internally it simply stores the current numeric value, initialised to 0.0.

The configuration tabs consist mainly of the standard state-scan controls, especially the scan-generator settings that define the sequence of values to visit. There are no hardware-specific settings for this plugin. The Help/About tab uses this docstring to explain the role of the plugin as a minimal example scan axis.

The Data tab enables collection, selects sequence outputs and their column roles, and controls when accumulated data is cleared or appended.

Variables:
  • _count (float) – Current stored counter value representing the present scan state.

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

  • scan_generator (BaseScanGenerator) – Inherited generator defining successive sequence points.

  • value (float) – Inherited current sequence control value.

  • ix (int) – Inherited zero-based iteration index.

  • 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 an instance named counter in the sequence, use the QtConsole to inspect or edit it before running. Substitute your instance name if different; result data reflects completed steps:

counter.collect_data = True
counter.value
counter.data.df.head()
get_state() → float[source]

Return the current counter value.

Returns:

The value most recently passed to set_state(), or 0.0 before any call to set_state().

Return type:

(float)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> plugin = CounterPlugin()
>>> plugin.get_state()
0.0
is_at_target() → bool[source]

Return True unconditionally.

Returns:

Always True.

Return type:

(bool)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> plugin = CounterPlugin()
>>> plugin.is_at_target()
True
property name: str

Unique identifier for this plugin.

Returns:

Always "Counter".

Return type:

(str)

set_state(value: float) → None[source]

Set the internal counter to value immediately.

Parameters:

value (float) – New counter value.

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> plugin = CounterPlugin()
>>> plugin.set_state(7.0)
>>> plugin.get_state()
7.0
property state_name: str

Human-readable name of the controlled quantity.

Returns:

Always "Value".

Return type:

(str)

property units: str

Physical unit of the counter value.

The counter is dimensionless, so the unit string is empty.

Returns:

Always "" (empty string).

Return type:

(str)