stoner_measurement.plugins.state_scan.xray_diffractometer.XrayDiffractometerScanPlugin

class stoner_measurement.plugins.state_scan.xray_diffractometer.XrayDiffractometerScanPlugin(parent=None)[source]

Bases: XrayDiffractometerPluginMixin, StateScanPlugin

Scan an X-ray diffractometer angle through discrete set-points.

Use this state scan to run nested measurement steps at a sequence of diffractometer angles. The standard Scan and Data tabs configure the point generator and collected outputs. New instances default to the multi-stage stepped generator. The Settings tab selects Theta/omega scan, Theta-2theta, or Detector/2theta scan. Motion uses the speed, datum offset, and mechanics configured in the shared X-ray engine. The preferred instrument is reconnected automatically when necessary and remains connected after the scan. At each point whose measurement flag is true, the plugin moves to the target and then acquires detector counts. The expression-capable count time is evaluated separately at each angle; the engine’s prior count time is restored after the scan.

In Theta-2theta mode, scan-generator values and value are detector 2-theta angles; the corresponding theta target is calculated internally. The instance exposes value, ix, theta, two_theta, and counts in the sequence namespace.

Variables:
  • axes (XrayMotionMode) – Motion relationship selected on Settings.

  • count_time (float | str) – Integration time in seconds or per-point expression.

  • theta (float) – Latest theta/omega angle in degrees.

  • two_theta (float) – Latest detector angle in degrees.

  • counts (float) – Latest detector count.

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

from stoner_measurement.xray_control import XrayMotionMode
xray_diffractometer_scan.axes = XrayMotionMode.COUPLED
xray_diffractometer_scan.count_time = 1.0
xray_diffractometer_scan.data.df.head()
configure() → None[source]

Remember the panel count time so the scan can restore it.

connect() → None

Connect the preferred diffractometer if necessary.

disconnect() → None[source]

Restore the count time that was configured before the scan.

property name: str

Unique human-readable name for this plugin.

ramp_to(value: float, poll_interval: float = 0.5) → None[source]

Move first, then acquire counts for measurement-enabled points.

property state_name: str

Human-readable name of the controlled or swept physical quantity.

Returns:

E.g. "Magnetic Field", "Temperature", "Time".

Return type:

(str)

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

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

Extends to_json() with a "scan_generator" key.

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_scan import CounterPlugin
>>> plugin = CounterPlugin()
>>> d = plugin.to_json()
>>> d["type"]
'state_scan'
>>> "scan_generator" in d
True
>>> d["collect_data"]
False
>>> d["clear_on_start"]
True
property units: str

Physical unit of the controlled or swept quantity.

Returns:

E.g. "T", "K", "s".

Return type:

(str)