Files
x07mb/script/test/ContinuousScan.py
2022-03-04 14:28:28 +01:00

43 lines
1.2 KiB
Python

#Number of cycles must be small otherwise generates a following error
def before_read(position, scan):
global total_time, steps
import time
start = time.time()
caput("X07MB-OP2:SMPL",1)
time.sleep(0.1)
print "Waiting..."
cawait ("X07MB-OP2:SMPL-DONE",1, 10000)
print "Done"
t = time.time()-start
print t
if t > (total_time/steps):
print "Before took too long, step = ", (total_time/steps)
def after(record, scan):
pass
#setup_plotting(line_plots = [mca_1])
print('running')
#cscan(ScanX, [keith_1] , 18, 18.3, 100, latency = 0.0, time = 2.0, before_read = before_read, after_read = None)
x0=16
x1=16.3
cycles = 1
dwell=(1+cycles)*0.2 # time per step
total_time=20.0
steps=int(total_time/dwell/4.)
speed=(x1-x0)/total_time
print(x0,x1,dwell,total_time,steps,speed,speed*0.5)
caput("X07MB-OP2:TOTAL-CYCLES",cycles)
caput("X07MB-ES-MA1:ScanX.VBAS",speed*.5)
#ScanX.config.minSpeed = speed*.5
#ScanX.config.save()
ret = cscan(ScanX, [keith_1,keith_2,keith_3,ScanX_RBV] , x0, x1, steps=steps, latency =0.0, time = total_time, before_read = before_read, after_read = None, domain_axis="Time")
caput("X07MB-ES-MA1:ScanX.VBAS",0.3)