OTF
This commit is contained in:
@@ -8,6 +8,7 @@ STEPS (int or tuple)
|
||||
LATENCY (double)
|
||||
RELATIVE (BOOLEAN)
|
||||
FLY_SCAN (BOOLEAN)
|
||||
ENDSCAN (BOOLEAN)
|
||||
"""
|
||||
|
||||
#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1})
|
||||
|
||||
@@ -159,6 +159,24 @@ def release_keithleys():
|
||||
KeiSample.release()
|
||||
KeiReference.release()
|
||||
|
||||
def otf(mode="ENERGY", e1=None, e2=None, beta1=None, beta2=None, theta1=None, theta2=None, \
|
||||
time=1.0, modulo=1, turn_off_beam=False):
|
||||
"""
|
||||
mode: "ENERGY" or "AMNGLE"
|
||||
"""
|
||||
run("otf", {
|
||||
"MODE":mode, \
|
||||
"E1":float(e1) if e1 is not None else None, \
|
||||
"E2":float(e2) if e2 is not None else None, \
|
||||
"BETA1":float(beta1) if beta1 is not None else None, \
|
||||
"BETA2":float(beta2) if beta2 is not None else None, \
|
||||
"THETA1":float(theta1) if theta1 is not None else None, \
|
||||
"THETA2":float(theta2) if theta2 is not None else None, \
|
||||
"TIME":float(time), \
|
||||
"MODULO":int(modulo), \
|
||||
"ENDSCAN":turn_off_beam, \
|
||||
})
|
||||
|
||||
diag_channels = []
|
||||
diag_channels.append(Scienta.channelBegin) #diag_channels.append(ChannelDouble("ChannelBegin", "X03DA-SCIENTA:cam1:CHANNEL_BEGIN_RBV"))
|
||||
diag_channels.append(Scienta.channelEnd) #diag_channels.append(ChannelDouble("ChannelEnd", "X03DA-SCIENTA:cam1:CHANNEL_END_RBV"))
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if get_exec_pars().source==CommandSource.ui:
|
||||
#Debugging parameters
|
||||
if not get_exec_pars().getCommand(False).args:
|
||||
1/0
|
||||
MODE = "ANGLE"
|
||||
E1 = 450.0
|
||||
E2 = 460.0
|
||||
@@ -6,18 +8,20 @@ if get_exec_pars().source==CommandSource.ui:
|
||||
BETA2 = -86.365
|
||||
THETA1 = 87.345
|
||||
THETA2 = 87.370
|
||||
TIME = 1 #min
|
||||
MODULO=4
|
||||
TIME = 1.0 #min
|
||||
MODULO=1
|
||||
ENDSCAN=False
|
||||
|
||||
|
||||
|
||||
if MODE=="ANGLE":
|
||||
raise Exception("Angle mode not supported")
|
||||
print "\nStart OTF scan... Beta", BETA1,"->",BETA2," Theta", THETA1,"->",THETA2, TIME,"- min modulo=",MODULO
|
||||
if None in [BETA1, BETA2, THETA1, THETA2]:
|
||||
raise Exception("Invalid angle")
|
||||
else:
|
||||
print "\nStart OTF scan...", E1,"eV ->",E2,"eV,",TIME,"- min modulo=",MODULO
|
||||
|
||||
if None in [E1, E2]:
|
||||
raise Exception("Invalid energy")
|
||||
|
||||
wait_beam()
|
||||
sensors = SampleCurrent, RefCurrent, MonoBeta, MonoTheta, MonoEnergy
|
||||
@@ -97,10 +101,7 @@ def after_read(rec):
|
||||
try:
|
||||
print "Scanning...",
|
||||
try:
|
||||
if MODE=="ANGLE":
|
||||
mscan(SampleCurrent, sensors, -1, None, range="auto", take_initial=False, after_read=after_read, monitors=[MonoEnergy, SampleCurrent, MachineCurrent])
|
||||
else:
|
||||
mscan(SampleCurrent, sensors, -1, None, range="auto", take_initial=False, after_read=after_read, domain_axis="MonoEnergy", monitors=[MonoEnergy, SampleCurrent, MachineCurrent])
|
||||
mscan(SampleCurrent, sensors, -1, None, range="auto", take_initial=False, after_read=after_read, domain_axis="MonoEnergy", snaps=diag_channels)
|
||||
finally:
|
||||
ret[0].cancel(True)
|
||||
|
||||
@@ -108,8 +109,8 @@ except:
|
||||
if not scan_completed:
|
||||
print sys.exc_info()
|
||||
print("Aborting...")
|
||||
caput('X03DA-OTF:RUN', 'STOP')
|
||||
raise
|
||||
finally:
|
||||
caput('X03DA-OTF:RUN', 'STOP')
|
||||
if ENDSCAN:
|
||||
after_scan()
|
||||
Reference in New Issue
Block a user