With some monitoring

This script demonstrates how the current position within the mesh can be displayed with some graphics ([*]).

#!/usr/bin/env python

import time, sys
import HasyUtils, Spectra
import PyTango

def main():
    #
    # x - the sweep motor
    #
    (nameX, startX, stopX, sweepTime, npX)  = ("d1_mot66", 0., 0.2, 5., 300)
    (nameY, startY, stopY, deltaY)  = ("d1_mot67", 0.1, 0.2, 0.01)

    npY = (stopY - startY)/deltaY + 1
    npY *= 2

    try:
        o = HasyUtils.moveLoop( nameX, startX, stopX, sweepTime, 
                      nameY, startY, stopY, deltaY)
    except Exception, e:
        print "Exception from moveLoop() constructor"
        print repr( e)
        sys.exit( 255)

    scanMesh = HasyUtils.scanMesh( nameX = nameX, nameY = nameY,
                                   comment = "%s: (%g, %g), %s: (%g, %g, %g)" %\
                                   (nameX, startX, stopX, nameY, startY, stopY, deltaY), 
                                   startX = startX, stopX = stopX, npX = npX, 
                                   startY = startY, stopY = stopY, npY = npY)

    try:
        o.toStart()
    except Exception, e:
        print "Exception from ToStart"
        print repr( e)
        sys.exitr( 255)

    while o.state() == PyTango.DevState.MOVING:
        print "toStart: posX %g, posY %g" % ( o.proxyX.Position, o.proxyY.Position)
        time.sleep(0.5)

    o.run()
    count = 0
    while o.state() == PyTango.DevState.MOVING:
        scanMesh.setX( count, o.proxyX.Position)
        scanMesh.setY( count, o.proxyY.Position)
        if count % 5 == 0:
            scanMesh.display()
        count += 1
        time.sleep(0.01)

    (sts, result) = Spectra.gra_yesno( "Enter Spectra")
    if result == 1:
        Spectra.gra_input()

if __name__ == "__main__":
    main()