Files
x04sa-es2/script/scans/6mom.py
T
gac-x04sa 520bb6235a Closedown
2018-01-12 15:18:10 +01:00

83 lines
2.5 KiB
Python

startphi=-60
endphi=120 # for DACs the middle is 57
time_step=4
step=0.5 # in degrees
#fname='testing'
fname='MRc_01' # remember the run number
#TODO: Should not move to startphi?
filt=caget("X04SA-ES2-FI:TRANSM",'d') *1000000000 #TODO:Check if wtiting 1000000000.00000000000000 or 1.0E9 is equivalent
caput("X04SA-ES2-PIL:cam1:FilterTransm",filt)
exp_time = time_step -0.003 # calculates Exposure time
phitot = endphi - startphi # calculates total omega span
images = int(phitot/step) # calculates number of images #TODO: floor or ceil?
velo = float(step)/time_step
if velo > 5.0:
raise Exception("Too fast velocity calculated for the motor, please change")
scr.setSpeed(velo) # speed of the omega axis in deg/s
tottime = time_step * images + 5 # calculates total time needed, adds 5 for safety
print "Total time: ", tottime
print "Collecting ", fname, "..."
# THE FOLLOWING LINES SEND COMMANDS TO THE CAMSERVER
det.numImages = images # number of images
det.exposure = exp_time # Exposure time
det.acquirePeriod = time_step # Acquire period
### FORWARD ###
# PLEASE NOTE THE FOLLOWING HAS NOT YET BEEN UPDATED FOR AUTOMATIC ANGLES
det.phiIncr = step
det.chi = 90
det.chiIncr = 0.0
det.omega = 57.05 # initial angle
det.startAngle = startphi # might be redundant
det.omegaIncr = 0.0 # increment angle
det.angleIncr = step # might be redundant
det.kappa = -134.76 # kappa
det.phi = 57.045 # phi
# PREPARE AND ACQUIRE
det.fileNumber = 1 # always start with image 1
sleep (1.0) #TODO: Why needed if another sleep below
det.fileName =fname # filename
sleep (1.0)
scr.moveAsync(endphi)
det.start()
#scr.waitReady(tottime * 1000) #TODO: Should sleep or wait end of move?
sleep(tottime)
### BACKWARD ###
# PLEASE NOTE THE FOLLOWING HAS NOT YET BEEN UPDATED FOR AUTOMATIC ANGLES
#det.phiIncr = $stepb
#det.chi = 90
#det.chiIncr = 0.0
#det.omega = 57.05 # initial angle
#det.startAngle = endphi # might be redundant
#det.omegaIncr = 0.0 # increment angle
#det.angleIncr = stepb # might be redundant
#det.kappa = -134.76 # kappa
#det.phi = 57.045 # phi
## PREPARE AND ACQUIRE
#det.fileNumber = 1 # always start with image 1
#sleep (1.0)
#det.fileName =fnameb # filename
#sleep (1.0)
#scr.move(startphi) # move the axis to ...
#det.start()
#sleep(tottime)
scr.setSpeed (5.0)
#sleep(1.0) #TODO: Using device this is not needed
scr.move(startphi, 20000)
#sleep(16.0) #TODO: Sync move, this is not needed