################################################################################################### 
# Using pseudo-device to : 
#    - Add calculations to scan data.
#    - Execute logic during scan
################################################################################################### 
      
       
class Clock(Readable):
    def read(self):
        return time.clock()

class Average(Readable):
    def read(self):
        arr = wf1.take()  #Gets the CACHED waveform
        return reduce(lambda x, y: x + y, arr) / len(arr) 

class PseudoPositioner(Writable):
    def write(self,pos):
        print "Step = " + str(pos)

clock=Clock()
av=Average()
positioner=PseudoPositioner()
setup_plotting(plot_list = [av,clock])
a= lscan((ao1,positioner),(wf1, ai2,av,clock),(0,0),(40,20),20,0.1)