#!/usr/bin/env python """helper macro to measure the time of the moves that are executed in a scan""" import PyTango from sardana.macroserver.macro import * from sardana.macroserver.macro import macro class moveScan(Macro): """helper macro to measure the time of the moves that are executed in a scan""" param_def = [ ['motor', Type.Moveable, None, "motor to move"], ['startRel', Type.Float, None, "startRel"], ['stopRel', Type.Float, None, "stopRel"], ['np', Type.Integer, None, "np"], ] result_def = [[ "result", Type.String, None, "a result" ]] def run(self, motor, startRel, stopRel, np): posOld = motor.getPosition() start = posOld + startRel stop = posOld + stopRel delta = (stop - start)/np p = start while p < stop: self.mv( motor, p) p = p + delta self.mv( motor, posOld) return True