Script execution
This commit is contained in:
@@ -1,22 +1,41 @@
|
||||
ID_ENERGY = 1250
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
ID_ENERGY = 1250
|
||||
HALFWIDTH = 10
|
||||
STEP = 0.5
|
||||
MODE = "Manual"
|
||||
|
||||
DRY_MODE = True
|
||||
|
||||
|
||||
# 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 )
|
||||
|
||||
if not DRY_MODE:
|
||||
caput('X07MA-PHS-E:OPT', 'PGM')
|
||||
energy_id.write(ID_ENERGY)
|
||||
wait_device(energy_done, 1 )
|
||||
sensors = [signal_i0, signal_tey, 'ca://X07MA-PC-K428:2:getTotalGain', energy]
|
||||
|
||||
if MODE != "Manual":
|
||||
POL = MODE
|
||||
ALPHA = None
|
||||
if MODE == "LINEAR H":
|
||||
POL = "LINEAR"
|
||||
ALPHA = 0
|
||||
elif MODE == "LINEAR V":
|
||||
POL = "LINEAR"
|
||||
ALPHA = 90
|
||||
caput('X07MA-ID:MODE', POL)
|
||||
time.sleep(1.0)
|
||||
if POL == 'LINEAR':
|
||||
caput('X07MA-ID:ALPHA', ALPHA)
|
||||
wait_channel('X07MA-ID:DONE', 'DONE', type = 's')
|
||||
|
||||
else:
|
||||
sensors = [sin, energy]
|
||||
|
||||
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)
|
||||
@@ -24,9 +43,11 @@ try:
|
||||
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
|
||||
finally:
|
||||
if not DRY_MODE:
|
||||
caput('X07MA-PHS-E:OPT', 'PGM+ID')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user