From e423612c8ef77929d2ec8a2698141866c09a41e0 Mon Sep 17 00:00:00 2001 From: gac-x03da Date: Thu, 17 May 2018 17:08:55 +0200 Subject: [PATCH] Script execution --- script/users/PhotonEnergyManipulator.py | 75 +++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 script/users/PhotonEnergyManipulator.py diff --git a/script/users/PhotonEnergyManipulator.py b/script/users/PhotonEnergyManipulator.py new file mode 100644 index 00000000..e8527d1b --- /dev/null +++ b/script/users/PhotonEnergyManipulator.py @@ -0,0 +1,75 @@ +""" +photon energy (resonance) scan with parallel manipulator movement +(to distribute exposure over sample) + +Arguments: + +VECTOR (Double[][], Scan vector: Eph,Elow,Ehigh or Eph,Ecenter) +SENSORS (list) +LATENCY (double) +MODE ('fixed' or 'swept') +TYPE ('CIS' or 'CFS') +STEP (double) +ENDSCAN +""" + +SENSORS = (Scienta.spectrum, Scienta.dataMatrix, Counts, SampleCurrent, RefCurrent, MachineCurrent) +LATENCY = 1.0 +MODE = 'swept' +ENDSCAN = True + +# photon energy scan range +EPHOT_LO = 625. +EPHOT_HI = 630. +EPHOT_STEP = 1. + +# energy range of first spectrum +EKIN_LO = 100. +EKIN_HI = 110. +EKIN_STEP = 0.1 +# 'CIS' = constant initial state (binding energy), 'CFS' = constant final state (kinetic energy) +TYPE = 'CFS' + +# manipulator range +MANIP_START = 116.4 +MANIP_END = 116.6 + + +### do not edit below + +NSTEPS = round((EPHOT_HI - EPHOT_LO) / EPHOT_STEP) + 1 +EPHOT_STEP = (EPHOT_HI - EPHOT_LO) / (NSTEPS - 1) + +ephot = [EPHOT_LO + EPHOT_STEP * i for i in range(NSTEPS)] +if TYPE == 'CIS': + eshift = [EPHOT_STEP * i for i in range(NSTEPS)] +else: + eshift = [0.] * NSTEPS +ekin_lo = [EKIN_LO + eshift[i] for i in range(NSTEPS)] +ekin_hi = [EKIN_HI + eshift[i] for i in range(NSTEPS)] + +MANIP_STEP = (MANIP_END - MANIP_START) / (NSTEPS - 1) +manip_z = [MANIP_START + MANIP_STEP * i for i in range(NSTEPS)] + +if MODE == "swept": + VECTOR = [[ephot[i], ekin_lo[i], ekin_hi[i], manip_z[i]] for i in range(NSTEPS)] + Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Swept) + Scienta.centerEnergy.write(VECTOR[0][1]) + writables = (Eph, Scienta.centerEnergy, ManipulatorZ) +else: + VECTOR = [[ephot[i], ekin_lo[i], manip_z[i]] for i in range(NSTEPS)] + Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Fixed) + Scienta.lowEnergy.write(VECTOR[0][1]) + Scienta.highEnergy.write(VECTOR[0][2]) + writables = (Eph, Scienta.lowEnergy, Scienta.highEnergy, ManipulatorZ) + + +adjust_sensors() +set_adc_averaging() +set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) + +try: + vscan(writables, SENSORS, VECTOR, True, LATENCY,False, before_read=before_readout, after_read = after_readout) +finally: + if ENDSCAN: + after_scan()