Script execution

This commit is contained in:
gac-x03da
2019-11-08 15:26:31 +01:00
parent 9ee7749b30
commit 1f55692afb

View File

@@ -0,0 +1,63 @@
"""
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 = 8.
STEP = 0.1
# move sample along beam
#ANGLE = +80.0
#DISTANCE = 4.
#STEP = 0.1
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
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()