THETA_RANGE = (0.0, 5.0) THETA_STEP = 1.0 PHI_RANGE = (-160.0, +160.0) PHI_STEP = 40.0 LATENCY = 0.0 ZIGZAG = True ENDSCAN = False MOTORS = (motor) SENSORS = (sin, arr, out, inp, motor.readback) set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) # time per scienta acquisition in second scienta_time = 0.1 print "scienta_time: ", scienta_time # time for one theta scan in seconds THETA_NSTEPS = int((THETA_RANGE[1] - THETA_RANGE[0]) / THETA_STEP) + 1 theta_time = scienta_time * THETA_NSTEPS print "theta_time: ", theta_time PHI_NSTEPS = int((PHI_RANGE[1] - PHI_RANGE[0]) / PHI_STEP) + 1 phi_positions = [PHI_RANGE[0] + PHI_STEP * i for i in range(PHI_NSTEPS)] print "phi_positions: ", phi_positions def before_pass(pass_num, scan): print "Initializing pass ", pass_num phi = phi_positions[pass_num] inp.write(phi) print "phi = ", phi #phi = phi_positions[record.index/THETA_NSTEPS] #ManipulatorPhi.write(phi) #print "phi = ", phi #ManipulatorPhi.waitValueInRange(phi, 1.0, 100) try: try: cscan(MOTORS, SENSORS, THETA_RANGE[0], THETA_RANGE[1], THETA_NSTEPS - 1, time=theta_time, passes = len(phi_positions), zigzag = ZIGZAG, before_pass=before_pass) except Exception: print sys.exc_info()[1] finally: if ENDSCAN: after_scan()