stoner_measurement.plugins.command.read_diffractometer.ReadDiffractometerCommand

class stoner_measurement.plugins.command.read_diffractometer.ReadDiffractometerCommand(parent=None)[source]

Bases: CommandPlugin

Read the X-ray diffractometer and expose its detector counts.

Use this command beneath a diffractometer scan or after a set command to acquire counts using the duration configured in the X-ray control panel. It has no instrument-specific settings. The preferred diffractometer is reconnected automatically when necessary, and the returned detector count is available as instance.value and as the command’s Counts scalar output.

Variables:
  • value (float) – Detector counts from the latest execution; initially NaN.

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

read_diffractometer.value
read_diffractometer.reported_values()
property controller_features: frozenset[str]

Return controller feature flags required by this plugin.

declared_outputs() → PluginOutputs[source]

Declare configured outputs and their physical units together.

execute() → None[source]

Perform the command action.

Called by the generated sequence script once per sequence step occurrence. The method has access to the full sequence engine namespace via engine_namespace and can evaluate Python expressions against it using eval().

The plugin instance is also callable — invoking plugin() is equivalent to calling plugin.execute().

Raises:

Exception – Any exception raised here propagates to the sequence engine and is reported as a script error attributed to this plugin.

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.command import CommandPlugin
>>> class _Log(CommandPlugin):
...     @property
...     def name(self): return "Logger"
...     def execute(self):
...         self.log.info("sequence step reached")
>>> p = _Log()
>>> p.execute()  # no error when detached (uses fallback logger)
>>> p()          # equivalent — __call__ delegates to execute()
property name: str

Unique human-readable name for this plugin.