stoner_measurement.plugins.monitor.temperature_controller.TemperatureMonitorPlugin

class stoner_measurement.plugins.monitor.temperature_controller.TemperatureMonitorPlugin(parent=None)[source]

Bases: MonitorPlugin

Publish live temperature-controller readings into the sequence value catalogue.

Use this monitor when you want the sequence to have access to live temperatures, setpoints, heater outputs, rates of change, and stability flags from the temperature-controller engine. The selected quantities are added to the sequence value catalogue and can then be plotted, saved, displayed, or used by other sequence steps.

In the configuration panel, choose which control loops and sensor channels should be monitored, and then select which quantities to report. You can

The General tab sets the instance name and comment. Measurement selection and polling options are on Settings.

enable any combination of:

  • Setpoint

  • Temperature

  • Heater

  • Rate of change

  • Stability

The configuration tab includes text fields for the control-loop list and sensor-channel list, together with check boxes for each reported quantity. A blank sensor-channel list means all channels currently known to the temperature-controller engine. A force fresh poll option is also available when each read should explicitly refresh the controller state.

For more technical use, the selected parameters are exposed both via read() / last_reading and as typed accessor methods on the instance itself (setpoint(), temperature(), heater(), rate(), stable()) so that they can be referenced directly in sequence scripts.

Use the catalogue pickers to combine readings from both controllers. Editable lists accept 1, secondary:1 for loops and A, secondary:A for sensors. Unqualified entries keep their primary meaning. Secondary is optional and is never required for an existing primary-only configuration. Explicit missing targets are reported as unavailable rather than replaced by another sensor. Console accessors also accept dictionaries such as {"controller_id": "secondary", "channel": "A"}.

Variables:
  • control_loops (list[int]) – Control loop numbers whose setpoint, heater output, and stability are reported. Defaults to [1].

  • sensor_channels (list[str] | None) – Sensor channel identifiers whose temperature and rate-of-change are reported. None reports all channels currently known to the engine.

  • report_setpoints (bool) – When True, setpoint values are included in every reading.

  • report_temperatures (bool) – When True, sensor temperatures are included in every reading.

  • report_heater (bool) – When True, heater output percentages are included in every reading.

  • report_rate (bool) – When True, rates of change are included in every reading.

  • report_stability (bool) – When True, stability flags (0.0 / 1.0) are included in every reading.

  • force_fresh_poll (bool) – Refresh controller state on each read rather than using cached 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.

  • last_reading (dict[str, float]) – Inherited read-only access to the latest cached readings.

  • monitor_interval (int) – Inherited timer polling interval in milliseconds; initially 1000.

Keyword Parameters:

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

Examples

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

temperature_monitor.control_loops = [1]
temperature_monitor.sensor_channels = None
temperature_monitor.last_reading
config_widget(parent: QWidget | None = None) → QWidget[source]

Return the configuration widget for this plugin.

Keyword Parameters:

parent (QWidget | None) – Optional Qt parent widget.

Returns:

Configuration widget with all plugin settings.

Return type:

(QWidget)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> w = m.config_widget()
>>> w is not None
True
configure() → None[source]

No-op — the engine is configured by dedicated state-control plugins.

connect() → None[source]

Ensure the engine is connected and start the polling timer.

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> m.transport_name = "Null (test)"
>>> m.driver_name = ""
>>> try:
...     m.connect()
... except RuntimeError:
...     pass
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.

disconnect() → None[source]

Stop the polling timer; the shared engine is left running.

heater(loop: int) → float[source]

Return the current heater output for loop as a percentage (0–100 %).

Parameters:

loop (int) – Control loop number (1-based).

Returns:

Heater output percentage, or math.nan when unavailable.

Return type:

(float)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> import math
>>> math.isnan(m.heater(1)) or isinstance(m.heater(1), float)
True
property name: str

Plugin display name.

Returns:

Always "Temperature Monitor".

Return type:

(str)

property quantity_names: list[str]

Ordered list of parameter keys returned by read().

The list is built dynamically from the current configuration and the engine’s known channels and loops.

Returns:

Parameter identifiers.

Return type:

(list[str])

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> m.sensor_channels = ["A"]
>>> m.control_loops = [1]
>>> names = m.quantity_names
>>> "setpoint_1" in names
True
>>> "temperature_A" in names
True
rate(channel: str) → float[source]

Return the estimated rate of change for channel in Kelvin per minute.

Parameters:

channel (str) – Sensor channel identifier (e.g. "A").

Returns:

Rate of change in K/min, or math.nan when unavailable.

Return type:

(float)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> import math
>>> math.isnan(m.rate("A")) or isinstance(m.rate("A"), float)
True
read(*, force_poll: bool = False) → dict[str, float][source]

Read the latest parameter snapshot from the engine.

By default retrieves the engine’s cached state without issuing additional hardware queries. When force_poll is True the engine performs an immediate hardware poll and the freshly read state is used, making the call synchronous with the hardware.

Keyword Parameters:

force_poll (bool) – When True, requests an immediate hardware poll from the engine before returning values. Defaults to False.

Returns:

Mapping of parameter name to current value. Returns math.nan for any parameter that cannot be obtained from the engine state.

Return type:

(dict[str, float])

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> m.sensor_channels = ["A"]
>>> m.control_loops = [1]
>>> reading = m.read()
>>> "setpoint_1" in reading
True
>>> reading_forced = m.read(force_poll=True)
>>> "setpoint_1" in reading_forced
True
setpoint(loop: int) → float[source]

Return the current setpoint for loop in Kelvin.

Parameters:

loop (int) – Control loop number (1-based).

Returns:

Setpoint in Kelvin, or math.nan when unavailable.

Return type:

(float)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> import math
>>> math.isnan(m.setpoint(1)) or isinstance(m.setpoint(1), float)
True
stable(loop: int) → float[source]

Return the stability flag for loop.

Parameters:

loop (int) – Control loop number (1-based).

Returns:

1.0 when stable, 0.0 when unstable, or math.nan when unavailable.

Return type:

(float)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> m.stable(1) in (0.0, 1.0)
True
temperature(channel: str) → float[source]

Return the current temperature reading for channel in Kelvin.

Parameters:

channel (str) – Sensor channel identifier (e.g. "A").

Returns:

Temperature in Kelvin, or math.nan when unavailable.

Return type:

(float)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> import math
>>> math.isnan(m.temperature("A")) or isinstance(m.temperature("A"), float)
True
to_json() → dict[str, object][source]

Serialise plugin configuration to a JSON-compatible dict.

Returns:

Serialised configuration.

Return type:

(dict[str, object])

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> d = m.to_json()
>>> d["report_setpoints"]
True
>>> "driver_name" in d
True
property units: dict[str, str]

Mapping of parameter name to physical unit string.

Returns:

Unit strings for each parameter.

Return type:

(dict[str, str])

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.monitor.temperature_controller import TemperatureMonitorPlugin
>>> m = TemperatureMonitorPlugin()
>>> m.sensor_channels = ["A"]
>>> m.control_loops = [1]
>>> m.units["setpoint_1"]
'K'
>>> m.units["heater_1"]
'%'