POSITIONERS = [dummy] RELATIVE = False SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, ManipulatorTempA, ManipulatorTempB, ManipulatorCoolFlow, EnergyDistribution, AngleDistribution) LATENCY = 0.0 ENDSCAN = True 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.05) Scienta.setPassEnergy(int(50)) Scienta.stepTime.write(0.0588) Scienta.setIterations(1) ExitSlit.write(200.) Scienta.update() def set_survey(): Eph.move(210.) Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Swept) Scienta.lowEnergy.write(140.) Scienta.highEnergy.write(145.) Scienta.stepSize.write(0.1) Scienta.setPassEnergy(int(50)) Scienta.stepTime.write(0.0588) Scienta.setIterations(1) 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, 3., 3., 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.) lscan(POSITIONERS, SENSORS, 3., 1., 3, LATENCY, RELATIVE, before_read=before_readout, after_read = my_after_read_down) print("wait for 10 K") ManipulatorTempA.waitValueInRange(10., 1., 60000) 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', 100.) lscan(POSITIONERS, SENSORS, 1., 3., 3, 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()