sc1.stop()
sc1.setOneShot()
sc1.channels[0].setPreset(False)
sc1.channels[0].setPresetValue(0)
sc1.start()

sensors = [
    CrlogicSensor("Trigger0", "TRIGGER0"),
    CrlogicSensor("Trigger1", "TRIGGER1"),    
    CrlogicSensor("Scaler0", "SCALER0", True),    
    CrlogicSensor("Scaler1", "SCALER1", True),    
    CrlogicSensor("Timestamp", "TIMESTAMP"),   
    RegisterCache(sin),
    ]


def before(pass_no):
    print "Start ", pass_no    

def after(pass_no):
    print "Stop", pass_no

hscan(crlogic_config, bragg, sensors, 0.0, 5.0, 0.1,1,  False, before_stream=before, after_stream=after)



""""
for i in range(1):
    pos = CrlogicPositioner("CrlogicPositioner", "MTEST-HW3:MOT1", None)
    pos.initialize()      
    
    try:
        #for i in range(10):
            print "-----------------  Scan " +str(i) + " -----------------"
            hscan(config, pos, sensors, 0.0, 5.0, 0.1,1,  False, before_stream=before, after_stream=after)
    finally:    
        pos.close()     
""""    