if get_exec_pars().source == CommandSource.ui: startphi=-10 endphi=0 # for DACs the middle is 57 time_step=1 step=0.5 # in degrees passes = 1 fname='test6mom' # remember the run number startphi, endphi, time_step, step = float(startphi), float(endphi), float(time_step), float(step) #TODO: Should not move to startphi? scr.setSpeed (5.0) scr.move(startphi, 60000) filt=caget("X04SA-ES2-FI:TRANSM",'d') *1000000000 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 = 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.chi = 90 det.chiIncr = 0.0 det.omega = 57.05 # initial angle det.omegaIncr = 0.0 # increment angle det.angleIncr = step # might be redundant det.kappa = -134.76 # kappa det.phi = 57.045 # phi for p in range(passes): if p % 2 == 0: det.phiIncr = step det.startAngle = startphi # might be redundant det.fileName = (fname + str(p)) if (passes > 1) else fname # filename dest = endphi else : det.phiIncr = -step det.startAngle = endphi # might be redundant det.fileName =fname + str(p) # filename dest = startphi det.fileNumber = 1 # always start with image 1 sleep (1.0) scr.moveAsync(dest) try: det.start() #sleep(tottime) scr.waitReady(int(tottime * 1000)) except: scr.stop() det.stop() raise scr.setSpeed (5.0) scr.move(startphi, 30000) #timeout = 30.0s