Timelapse scripting


The timelapse module performs its tasks by invoking a script chosen by the user.
The user can also write their own scripts.

Here is an example.
The Python scripting API (commands).

Introduction

To each script there are four functions which are invoked by the Python interpreter.

OnStart() - This is called when the timelapse is started by the user.
This function takes no parameters.

OnAbort() - This is called when the timelapse experiment is stopped or aborted.
This function takes no parameters.

OnCycleStart() - This is called once at the start of each cycle of points. It should contain at least one call to microscope.VisitPoints() to start the cycle.
This function takes no parameters.

OnNewPoint(x, y, z, position) - This is called each time the stage moves to a new point.
The parameters, which are passed to the function, are the x, y and z co-ordinates of the stage and the position of the current point within the list of positions that we are iterating.
A skeleton program which simply prints out the position of each of the timelapse points would be written as so: (remember white space indentation is relevant in Python)

import sys
import microscope

def OnStart():
    print "OnStart()"

def OnAbort():
    print "OnAbort()"

def OnCycleStart():
    print "OnCycleStart"
    microscope.VisitPoints()

def OnNewPoint(x, y, z, position):
    print "NewPoint()"