From 84914923752fef3058b71d348c4d0ad4db927186 Mon Sep 17 00:00:00 2001 From: gac-x03da Date: Mon, 12 Aug 2019 15:54:05 +0200 Subject: [PATCH] Script execution --- script/test/FindCenter.py | 50 ++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/script/test/FindCenter.py b/script/test/FindCenter.py index 29743f91..d46cf3f7 100644 --- a/script/test/FindCenter.py +++ b/script/test/FindCenter.py @@ -15,42 +15,60 @@ START_POS = 0.0 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 - SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent) MOTORS = ManipulatorY -RANGE = (START_POS - 5., START_POS + 5.) -STEP = 0.2 +RANGE = (START_POS + 5., START_POS - 5.) -# time for one scan in seconds +Scienta.setExposure(0.5) +scienta_time = 3.75 +print "scienta time: ", scienta_time + +STEP = 0.2 SPEED = STEP / scienta_time -print "speed: ", SPEED fly_time = (RANGE[1] - RANGE[0]) / SPEED STEPS = int(fly_time / scienta_time) + 1 + +print "coarse scan" +print "speed: ", SPEED print "scan time: ", fly_time set_exec_pars(keep=True) result = cscan(MOTORS, SENSORS, RANGE[0], RANGE[1], STEPS, time=fly_time, before_read=before_readout, after_read = after_readout, check_positions = False) + readable = result.getReadable(0) positions = result.getPositions(0) min_counts = min(readable) max_counts = max(readable) thresh = (max_counts - min_counts) / 2. + min_counts print "threshhold: ", thresh + sample_positions = [pos for idx, pos in enumerate(positions) if readable[idx] >= thresh] lo_edge = min(sample_positions) hi_edge = max(sample_positions) -print "low and high edge: ", lo_edge, ", ", hi_edge +print "lower edge, upper edge: ", lo_edge, ", ", hi_edge -RANGE = (hi_edge - 0.4, hi_edge + 0.4) -STEP = 0.01 -result = cscan(MOTORS, SENSORS, RANGE[0], RANGE[1], STEPS, time=fly_time, before_read=before_readout, after_read = after_readout, check_positions = False) RANGE = (lo_edge - 0.4, lo_edge + 0.4) STEP = 0.01 -result = cscan(MOTORS, SENSORS, RANGE[0], RANGE[1], STEPS, time=fly_time, before_read=before_readout, after_read = after_readout, check_positions = False) +SPEED = STEP / scienta_time +fly_time = (RANGE[1] - RANGE[0]) / SPEED +STEPS = int(fly_time / scienta_time) + 1 + +print "lower edge scan" +print "speed: ", SPEED +print "scan time: ", fly_time + +cscan(MOTORS, SENSORS, RANGE[0], RANGE[1], STEPS, time=fly_time, before_read=before_readout, after_read = after_readout, check_positions = False) + + +RANGE = (hi_edge - 0.4, hi_edge + 0.4) +STEP = 0.01 +SPEED = STEP / scienta_time +fly_time = (RANGE[1] - RANGE[0]) / SPEED +STEPS = int(fly_time / scienta_time) + 1 + +print "upper edge scan" +print "speed: ", SPEED +print "scan time: ", fly_time + +cscan(MOTORS, SENSORS, RANGE[0], RANGE[1], STEPS, time=fly_time, before_read=before_readout, after_read = after_readout, check_positions = False)