#!/bin/env python
#
# file name: /home/pXXuser/sardanaMacros/LoopOfScans_class.py
#
"""this module contains some demo code"""
__all__ = ["LoopOfScans_class"]
from sardana.macroserver.macro import Macro, Type
class LoopOfScans_class(Macro):
"""executes a loop of scans"""
param_def = [
[ "mot1", Type.Moveable, None, "the inner loop motor" ],
[ "mot2", Type.Moveable, None, "the outer loop motor" ],
[ "delta", Type.Float, None, "a floating point number" ],
[ "np", Type.Integer, None, "the no. of points" ],
[ "comment", Type.String, None, "a comment line" ],
]
def run(self, mot1, mot2, delta, np, comment):
self.output( "Comment: %s " % comment)
posOld = mot2.position
for i in range(0, np):
newPos = posOld + i*delta
self.output( "%s is moving to %g" % (mot2.name, newPos))
self.mv(mot2, newPos)
self.output( "%s is at %g" % (mot2.name, mot2.position))
self.ascan( mot1, 0, 0.1, 5, 0.1)
self.mv( mot2, posOld)