From aac4b91b57d682998b314a6dd1260b610c9fca63 Mon Sep 17 00:00:00 2001 From: gac-x09lb Date: Mon, 3 Oct 2022 10:10:39 +0200 Subject: [PATCH] Script execution --- script/templates/Scan2D.py | 56 ++++++++++++++------------------------ 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/script/templates/Scan2D.py b/script/templates/Scan2D.py index 5f3683f..a419839 100644 --- a/script/templates/Scan2D.py +++ b/script/templates/Scan2D.py @@ -1,46 +1,30 @@ """ Arguments: -MOTOR (device) +MOTORS (list) SENSORS (list) -RANGE (tuple (min, max)) -STEPS (int or tuple) +RANGE_X (tuple (min, max)) +RANGE_Y (tuple (min, max)) +STEPS (tuple (x, y)) LATENCY (double) RELATIVE (BOOLEAN) -FLY_SCAN (BOOLEAN) -ENDSCAN (BOOLEAN) +ZIGZAG (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) + + +#Debugging +if get_exec_pars().args is None: + MOTORS = [dummy_x, dummy_y] + SENSORS = [current] + RANGE_X = [0.0,2.0] + RANGE_Y = [0.0,1.0] + STEPS = [5, 10] + LATENCY = 0.1 + RELATIVE = False + ZIGZAG = 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) + ascan((ManipulatorPhi, ManipulatorTheta), SENSORS, (PHI_RANGE[0], THETA_RANGE[0]), (PHI_RANGE[1], THETA_RANGE[1]), STEPS, LATENCY, RELATIVE, zigzag = ZIGZAG, \ + before_read=before_readout, after_read = after_readout, compression = True) finally: - if ENDSCAN: - after_scan() + after_scan() \ No newline at end of file