Files
x03da/script/ManipulatorScan.py
gac-x03da 4cbf6c714e Closedown
2022-08-08 14:19:55 +02:00

47 lines
1.5 KiB
Python

"""
Arguments:
MOTOR (device)
SENSORS (list)
RANGE (tuple (min, max))
STEPS (int or tuple)
LATENCY (double)
RELATIVE (BOOLEAN)
FLY_SCAN (BOOLEAN)
ENDSCAN (BOOLEAN)
"""
#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1})
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(MOTOR, SENSORS, RANGE[0], RANGE[1], STEPS, LATENCY, fly_time, RELATIVE, before_read=before_readout, after_read = after_readout, check_positions = False)
else:
lscan(MOTOR, SENSORS, RANGE[0], RANGE[1], STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout)
finally:
if ENDSCAN:
after_scan()