From 1f55692afbc6a305d3100af9731564fadcb841b8 Mon Sep 17 00:00:00 2001 From: gac-x03da Date: Fri, 8 Nov 2019 15:26:31 +0100 Subject: [PATCH] Script execution --- .../Niels/20191108_ManipulatorXYFlyScan.py | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 script/users/Niels/20191108_ManipulatorXYFlyScan.py diff --git a/script/users/Niels/20191108_ManipulatorXYFlyScan.py b/script/users/Niels/20191108_ManipulatorXYFlyScan.py new file mode 100644 index 00000000..82983f2d --- /dev/null +++ b/script/users/Niels/20191108_ManipulatorXYFlyScan.py @@ -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()