Files
x03da/script/ManipulatorXYFlyScan.py
2023-03-22 09:49:19 +01:00

66 lines
1.6 KiB
Python

"""
Manipulator scan across the beam relative to current position
set manipulator scan parameters below.
set analyser parameters separately!
move manipulator to center position before start!
set ANGLE = -30.0 to move the sample across the beam.
set ANGLE = +60.0 to move the sample along the beam.
"""
import math
# adjust the following parameters
# move sample across beam
ANGLE = -30.
DISTANCE = 14.
STEP = 0.05
# move sample along beam
#ANGLE = +80.0
#DISTANCE = 4.
#STEP = 0.1
SENSORS = (SampleCurrent, RefCurrent, MachineCurrent)
#SENSORS = (Counts, AngleDistribution, EnergyDistribution, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent)
ENDSCAN = False
# --- do not edit below ---
DISTANCE_X = DISTANCE * math.cos(math.radians(ANGLE))
DISTANCE_Y = DISTANCE * math.sin(math.radians(ANGLE))
MOTORS = (ManipulatorX, ManipulatorY)
STARTPOS = (-DISTANCE_X / 2.0, -DISTANCE_Y / 2.0)
ENDPOS = (DISTANCE_X / 2.0, DISTANCE_Y / 2.0)
RELATIVE = True
adjust_sensors()
set_adc_averaging()
# time per scienta acquisition in seconds
#time1 = time.time()
#trig_scienta()
#time2 = time.time()
#scienta_time = (time2 - time1)
#print "scienta time: ", scienta_time
# time for one scan in seconds
scienta_time = 0.5
SPEED = STEP / scienta_time
print "speed: ", SPEED
fly_time = DISTANCE / SPEED
STEPS = int(fly_time / scienta_time) + 1
print "scan time: ", fly_time
try:
set_exec_pars(compression=True)
cscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, time=fly_time, relative=RELATIVE, before_read=before_readout, after_read = after_readout, check_positions = False)
finally:
if ENDSCAN:
after_scan()