Reach()
Jump to navigation
Jump to search
The function 'reach' is called at each measurement point after apply() has been called for all modules of the branch. For each module, it is only called if a new value was applied in apply(), i.e. if the sweep value has changed.
Use 'reach' to wait until the new set value is actually reached, e.g. until a temperature controller reports that the set temperature is stable or a motor has arrived at its position. The new set value is available as self.value. After 'reach' has been called for all modules, the hold times of the modules are waited.
If you wait in a loop, check self.is_run_stopped() in each iteration so that the user can stop the run:
def reach(self):
# wait until the instrument reports that the set value is reached
while not self.is_run_stopped():
if self.is_setpoint_reached(): # your own function that asks the instrument
break
time.sleep(0.5) # requires 'import time' at the top of main.py