id4_common.utils.temperature_setup#

Label-keyed setup helper for the active temperature controller (issue #57).

Picks one entry from TEMPERATURE_CONTROLLERS, resolves its setpoint and readback signals on the registered device, and injects the result into the interactive session as three names:

  • tc — the temperature control signal (movable, the setpoint)

  • ts — the temperature sample signal (readable, the readback)

  • TEMPERATURE_CONTROLLER — the active label (or None)

After temperature_setup("g") the user can mv tc 295 / RE(count(1, 1)) and the sample temperature will land in the data and (by default) the baseline stream every scan.

Adding a new controller is a one-line edit to the TEMPERATURE_CONTROLLERS dict below — no class changes, no devices.yml edits.

Module Contents#

id4_common.utils.temperature_setup.TEMPERATURE_CONTROLLERS#
id4_common.utils.temperature_setup.get_active_label()#

Return the currently-active controller label, or None.

id4_common.utils.temperature_setup.get_active_tc()#

Return the currently-active setpoint signal, or None.

id4_common.utils.temperature_setup.get_active_ts()#

Return the currently-active readback signal, or None.

id4_common.utils.temperature_setup.temperature_setup(label=None, *, add_to_baseline=True)#

Bind tc (setpoint) and ts (readback) to the requested controller.

Parameters:
  • label (str, optional) – Key into TEMPERATURE_CONTROLLERS. If None (default), prompt interactively, defaulting to the previously-active label (or no default on the first call of the session).

  • add_to_baseline (bool, optional) – If True (default), append ts to sd.baseline so the sample temperature is recorded in every scan’s baseline stream. Removes any previously-active ts from the baseline first so re-running temperature_setup swaps cleanly.

  • effects (Side)

  • ------------

  • success (On)

  • __main__ (sets the following attributes on)

  • (movable). (- tc — the resolved setpoint signal)

  • (readable). (- ts — the resolved readback signal)

  • string. (- TEMPERATURE_CONTROLLER — the active label)

Raises: