Apply()

From SweepMe! Wiki
(Redirected from Apply)
Jump to navigation Jump to search

The function 'apply' is where the new Sweep value (i.e. set value) should be send to a measurement device. The latest Sweep value is simply available in each instrument driver as 'self.value' and is automatically updated once a new Sweep value is available.

It is good practice to convert the value to the type that you need to process it, e.g. float or str because there is no convention whether self.value must be always str, int, or float, or any other type.

The functions 'apply()' and 'reach()' are only called if the sweep value has changed. This prevents that a set value is sent multiple times to an instrument. For example, a repetitive measurement at a voltage of 0 V only requires to set 0 V at the first measurement point. For all subsequent measurement points, sending 0 V is not needed, which is why apply is not called again.

If the sweep value is a float that is NaN (not a number), 'apply' is skipped as well.

When a module becomes active again after it was unconfigured (see unconfigure()), or at the beginning of a new run, the next sweep value is always applied, even if it is the same as before.