From 542ffce3c7b5d86f28cdc93de646c8db3c4a58f3 Mon Sep 17 00:00:00 2001 From: gac-x03da Date: Wed, 22 Apr 2020 11:29:14 +0200 Subject: [PATCH] Script execution --- script/users/monney/TemperatureRamp.py | 44 ++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/script/users/monney/TemperatureRamp.py b/script/users/monney/TemperatureRamp.py index 7a5f1a87..b68fb565 100644 --- a/script/users/monney/TemperatureRamp.py +++ b/script/users/monney/TemperatureRamp.py @@ -1,8 +1,9 @@ -POSITIONERS = [dummy, ManipulatorCoolFlowSet] +POSITIONERS = [dummy] RELATIVE = False SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution, Scienta.dataMatrix, ManipulatorTempA, ManipulatorTempB, ManipulatorCoolFlow) LATENCY = 0.0 +ENDSCAN = False adjust_sensors() set_adc_averaging() @@ -30,26 +31,55 @@ def set_survey(): Scienta.stepSize.write(0.1) Scienta.setPassEnergy(int(50)) Scienta.stepTime.write(0.0588) - Scienta.setIterations(1) + Scienta.setIterations(2) ExitSlit.write(200.) Scienta.update() +def set_cool_down(): + temp = ManipulatorTempA.read() + flow = min(40., 10. + 0.15 * (300. - temp)) + ManipulatorCoolFlowSet.write(flow) + +def set_cool_up(): + temp = ManipulatorTempA.read() + flow = min(40., 0. + 0.15 * (300. - temp)) + ManipulatorCoolFlowSet.write(flow) + +def my_after_read_down(rec, scan): + after_readout(rec, scan) + set_cool_down() + +def my_after_read_up(rec, scan): + after_readout(rec, scan) + set_cool_up() try: + print("survey") set_survey() - lscan(POSITIONERS, SENSORS, (1., 10.), (1., 10.), 1, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) + lscan(POSITIONERS, SENSORS, 1., 1., 0, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) + print("4f ramping down") set_4f() - lscan(POSITIONERS, SENSORS, (300., 15.), (10., 40.), 150, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) + caput('X03DA-PC-LAKESHORE:1-TEMP_SP', 10.) + lscan(POSITIONERS, SENSORS, 300., 10., 150, LATENCY, RELATIVE, before_read=before_readout, after_read = my_after_read_down) + # print("wait for 10 K") + # the timeout is dangerous, it may cause an exception! + # time.sleep(600) # seconds + # ManipulatorTempA.waitValueInRange(10., 5., 600000) # milliseconds + + print("survey") set_survey() - lscan(POSITIONERS, SENSORS, (1., 40.), (1., 40.), 1, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) + lscan(POSITIONERS, SENSORS, 1., 1., 0, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) + print("4f ramping up") set_4f() - lscan(POSITIONERS, SENSORS, (10., 20.), (300., 0.), 150, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) + caput('X03DA-PC-LAKESHORE:1-TEMP_SP', 300.) + lscan(POSITIONERS, SENSORS, 10., 300., 150, LATENCY, RELATIVE, before_read=before_readout, after_read = my_after_read_up) + print("survey") set_survey() - lscan(POSITIONERS, SENSORS, (1., 0.), (1., 0.), 1, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) + lscan(POSITIONERS, SENSORS, 1., 1., 0, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) finally: if ENDSCAN: