POSITIONERS = [dummy] RELATIVE = False SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution, Scienta.dataMatrix, ManipulatorTempA, ManipulatorTempB, ManipulatorCoolFlow) LATENCY = 0.0 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(300.) 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 = max(40., 10. + 0.15 * (300. - temp)) ManipulatorCoolFlowSet.write(flow) def set_cool_up(): temp = ManipulatorTempA.read() flow = max(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: set_survey() lscan(POSITIONERS, SENSORS, 3., 3., 1, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) 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) ManipulatorTempA.waitValueInRange(10., 5., 60) set_survey() lscan(POSITIONERS, SENSORS, 1., 1., 1, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) 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) set_survey() lscan(POSITIONERS, SENSORS, 1., 1., 1, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) finally: if ENDSCAN: after_scan()