""" Scan refocusing mirror RY and manipulator X in parallel (to find analyser focus). Beam stays on same spot on the sample. set scan parameters below. set analyser parameters separately! move manipulator and mirror to center position before start! """ import math # adjust the following parameters DISTANCE_X = 1.0 # mm #DISTANCE_Ry = 0.5 # mrad (Ry) SLOPE = 1.75 # mm/mrad (DX / DRy) STEPS = 50 LATENCY = 0.0 ENDSCAN = False # do not edit below #DISTANCE_X = DISTANCE_Ry * SLOPE DISTANCE_Ry = DISTANCE_X / SLOPE print DISTANCE_Ry MOTOR = (RefocusYRot, ManipulatorX) SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) STARTPOS = (-DISTANCE_Ry / 2.0, -DISTANCE_X / 2.0) ENDPOS = (DISTANCE_Ry / 2.0, DISTANCE_X / 2.0) RELATIVE = True print STARTPOS print ENDPOS adjust_sensors() set_adc_averaging() def trig_sensors(): wait_beam() trig_scienta() caput("X03DA-OP-10ADC:TRG.PROC", 1) try: lscan(MOTOR, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig_sensors, after_read = after_readout) finally: if ENDSCAN: after_scan()