Files
x03da/script/DeflectorScan.py
gac-x03da 51a7288d26 Closedown
2023-12-06 10:16:58 +01:00

63 lines
1.9 KiB
Python

"""
Arguments:
MOTOR (device)
SENSORS (list)
RANGE (tuple (min, max))
STEPS (int or tuple)
LATENCY (double)
RELATIVE (BOOLEAN)
FLY_SCAN (BOOLEAN)
ENDSCAN (BOOLEAN)
"""
MOTORS = (ScientaCenterThetaY)
# save Scienta image:
SENSORS = (Counts, Scienta.dataMatrix, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution)
# don't save Scienta image, derived data only:
# SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution)
STARTPOS = -14.
ENDPOS = +14.
# if integer, actual number of positions will be +1!
STEPS = 0.5
RELATIVE = False
LATENCY = 0.0
ENDSCAN = True
ZIGZAG = False
FLY_SCAN = False
adjust_sensors()
set_adc_averaging()
set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1})
set_exec_pars(compression=True)
try:
if FLY_SCAN:
# time per scienta acquisition in seconds
trig_scienta()
time1 = time.time()
before_readout()
time.sleep(0.2)
time2 = time.time()
scienta_time = (time2 - time1) + 1.
print "step time: ", scienta_time
if isinstance(STEPS,int):
raise Exception ("Fly Scan must define step size, and not number of steps")
STEP = STEPS[0]
SPEED = STEP / scienta_time
fly_time = (RANGE[1] - RANGE[0]) / SPEED
STEPS = int(fly_time / scienta_time) + 1
print "speed: ", SPEED
print "scan time: ", fly_time
cscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, fly_time, RELATIVE, before_read=before_readout, after_read = after_readout, check_positions = False)
else:
lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout)
finally:
if ENDSCAN:
after_scan()