mpylab.device.switch moduleΒΆ

mpylab.device.switch module.

mpylab.device.switch.switch(swstr=None, fstr=None, fs=None)

Select a legacy switch state from an outer-scope variable.

Parameters:
  • swstr (str, optional) – Name of the switch instance in an outer frame, for example "self.sw".

  • fstr (str, optional) – Name of the controlling variable in an outer frame, commonly "f".

  • fs (float or sequence of float, optional) – Ordered switching thresholds. The first threshold above the current value determines the switch state.

Returns:

Status returned by switch_to, or -1 when required outer-scope values are unavailable.

Return type:

int

Notes

This helper uses legacy outer-frame introspection. New measurement graphs should use explicit condition mappings and MGraph.EvaluateConditions().