From 4f7059229369320ed42475d1e4bad71e33bedbc2 Mon Sep 17 00:00:00 2001 From: Alexandre Gobbo Date: Wed, 17 Jun 2020 10:41:20 +0200 Subject: [PATCH] Startup --- script/HarmonicScan.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 script/HarmonicScan.py diff --git a/script/HarmonicScan.py b/script/HarmonicScan.py new file mode 100644 index 0000000..7fe808b --- /dev/null +++ b/script/HarmonicScan.py @@ -0,0 +1,32 @@ +ID_ENERGY = 1250 + + + +# energy at which the ID offset should be determined +#======================== +HALFWIDTH = 10 +STEP = 0.5 + +#======================== +try: + caput('X07MA-PHS-E:OPT', 'PGM') + energy_id.write(ID_ENERGY) + wait_device(energy_done, 1 ) + + def before(position, scan): + #wait_device(energy_done, 1 ) + sleep( 0.3 ) # Settling time + + #ret = lscan(energy, [signal_i0, signal_tey, 'ca://X07MA-PC-K428:2:getTotalGain', 'ca://X07MA-ID:MODE?type=d', pol_angle, current, energy, pol_offset, 'ca://X07MA-ID-GAP:READ','ca://X07MA-ID-SHIFT:READ'], ID_ENERGY-HALFWIDTH, ID_ENERGY+HALFWIDTH, STEP, before_read = before) + ret = lscan(energy, [signal_i0, signal_tey, 'ca://X07MA-PC-K428:2:getTotalGain', energy], ID_ENERGY-HALFWIDTH, ID_ENERGY+HALFWIDTH, STEP, before_read = before) + xdata = ret.getPositions(0) + ydata = ret.getReadable(0) + ymin = min(ydata) + xminmin = xdata[ydata.index(min(ydata))] + print "Emin=",xminmin,"ymin = ",ymin + caput('X07MA-PHS-E:OPT', 'PGM+ID') + +except: + print("Aborting...") + caput('X07MA-PHS-E:OPT', 'PGM+ID') + raise