From 100809f1631ed866af601a35a1f8edafb0237e2c Mon Sep 17 00:00:00 2001 From: gac-x03da Date: Tue, 9 Jul 2019 16:06:44 +0200 Subject: [PATCH] Script execution --- script/develop/ManipulatorYZFlyScan.py | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 script/develop/ManipulatorYZFlyScan.py diff --git a/script/develop/ManipulatorYZFlyScan.py b/script/develop/ManipulatorYZFlyScan.py new file mode 100644 index 00000000..210e4fac --- /dev/null +++ b/script/develop/ManipulatorYZFlyScan.py @@ -0,0 +1,59 @@ +""" +Continuous 2D Manipulator scan (experimental) + +set manipulator scan parameters below. +set analyser parameters separately! +""" + +import math + +MOTORS = (ManipulatorY) +#SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) +SENSORS = (Counts, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) +RANGE_Y = (-5., +5) +RANGE_Z = (114., 116.) +STEPS_Y = 20 +# actual number of positions will be +1! +STEPS_Z = 2 +RELATIVE = False +LATENCY = 0.0 +ENDSCAN = False +ZIGZAG = False + +#set_preference(Preference.ENABLED_PLOTS, [ManipulatorPhi, ManipulatorTheta, Scienta.dataMatrix, ImageIntegrator]) +#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1}) +adjust_sensors() +set_adc_averaging() +#set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) + +# 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 Y scan in seconds +fly_time = scienta_time * STEPS_Y +print "Y time: ", fly_time + +STEP_Z = (RANGE_Z[1] - RANGE_Z[0]) / STEPS_Z +positions_z = [RANGE_Z[0] + STEP_Z * i for i in range(STEPS_Z)] +print "Z positions: ", positions_z + +def before_pass(index, scan): + global positions_z + print "Starting pass: ", index + z = positions_z[index-1] + ManipulatorZ.write(z) + print "z = ", z + ManipulatorZ.waitValueInRange(z, 1.0, 100) + + +try: + cscan(MOTORS, SENSORS, RANGE_Y[0], RANGE_Y[1], STEPS_Y, time=fly_time, passes=len(positions_z), zigzag=ZIGZAG, before_read=before_readout, after_read = after_readout, before_pass = before_pass, check_positions = False) + +finally: + if ENDSCAN: + after_scan() + \ No newline at end of file