POSITIONERS = [dummy] RELATIVE = False SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, Scienta.spectrum, EnergyDistribution, AngleDistribution, Scienta.dataMatrix, ManipulatorTempA, ManipulatorTempB, ManipulatorCoolFlow) LATENCY = 0.0 ENDSCAN = False adjust_sensors() set_adc_averaging() set_exec_pars(compression=True) set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) def set_4f(): Eph.move(200.) Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Swept) Scienta.lowEnergy.write(130.5) Scienta.highEnergy.write(137.0) Scienta.stepSize.write(0.01) Scienta.setPassEnergy(int(50)) Scienta.stepTime.write(0.0588) Scienta.setIterations(1) ExitSlit.write(200.) Scienta.update() def set_survey(): Eph.move(1500.) Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Swept) Scienta.lowEnergy.write(800.) Scienta.highEnergy.write(1500.) Scienta.stepSize.write(0.1) Scienta.setPassEnergy(int(50)) Scienta.stepTime.write(0.0588) Scienta.setIterations(2) ExitSlit.write(200.) Scienta.update() def set_cool_down(): temp = ManipulatorTempA.read() flow = max(0., min(40., 10. + 0.15 * (300. - temp))) ManipulatorCoolFlowSet.write(flow) def set_cool_up(): temp = ManipulatorTempA.read() flow = max(0., 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., 1., 0, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) print("4f ramping down") set_4f() caput('X03DA-PC-LAKESHORE:1-TEMP_SP', 10.) print("scanning") lscan(POSITIONERS, SENSORS, 0., 1., 1500, 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., 1., 0, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) # print("4f ramping up") # set_4f() # caput('X03DA-PC-LAKESHORE:1-TEMP_SP', 300.) # lscan(POSITIONERS, SENSORS, 0., 1., 200, LATENCY, RELATIVE, before_read=before_readout, after_read = my_after_read_up) # print("survey") # set_survey() # lscan(POSITIONERS, SENSORS, 1., 1., 0, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) finally: if ENDSCAN: after_scan()