Script execution
This commit is contained in:
+27
-18
@@ -74,27 +74,22 @@ def _startPlot(type):
|
||||
TEY = []
|
||||
dE1 = 0.0
|
||||
dE2 = 0.0
|
||||
t_start = time.time()
|
||||
t_end = time.time() + TIME*60.0
|
||||
#print t_start
|
||||
# print t_end
|
||||
#sTEYout = []
|
||||
t_start = time.clock()
|
||||
t_end = time.clock() + TIME*60.0
|
||||
while running:
|
||||
try:
|
||||
if otf_start.read() == 0:
|
||||
#if (otf_start.read() == 0 or time.time() > t_end):
|
||||
break
|
||||
e = energy.read()
|
||||
'''cur_en = E1+(E2-E1)*(time.time()-t_start)/(TIME*60)
|
||||
caput ("X11MA-PHS:E_SP",cur_en)
|
||||
|
||||
cur_en1 = cur_en - dE1
|
||||
cur_en2 = cur_en - dE2
|
||||
#print cur_en
|
||||
# print cur_en1
|
||||
#print cur_en2
|
||||
caput ("X11MA-ID1:ENERGY",cur_en1)
|
||||
caput ("X11MA-ID2:ENERGY",cur_en2)
|
||||
if OTF_override == 1:
|
||||
cur_en = E1+(E2-E1)*(time.clock()-t_start)/(TIME*60)
|
||||
#caput ("X11MA-PHS:E_SP",cur_en)
|
||||
cur_en1 = cur_en - dE1
|
||||
cur_en2 = cur_en - dE2
|
||||
caput ("X11MA-ID1:ENERGY",e)
|
||||
caput ("X11MA-ID2:ENERGY",e)
|
||||
time.sleep(0.0001)
|
||||
#while abs (e - cur_en) < 0.01:
|
||||
# pass
|
||||
#time.sleep(0.0001)'''
|
||||
@@ -164,7 +159,7 @@ def switchpol(activeID, runtype):
|
||||
raise Exception("Invalid parameter")
|
||||
|
||||
mag_str = None
|
||||
mag_str = caget(MAG)
|
||||
#mag_str = caget(MAG)
|
||||
pol_str = None
|
||||
polswitch = 1
|
||||
|
||||
@@ -264,15 +259,29 @@ for scan_no in range(number_of_scans):
|
||||
convert_file(input_file, output_file, mag_str, pol_str)
|
||||
plot_file(output_file, file_prefix+"_" + suffix) #"Scan " + str(scan_no+1))
|
||||
print "Finished scan " + str(scan_no+1) + " out of " + str(number_of_scans)
|
||||
|
||||
|
||||
if Magnet == 1:
|
||||
sMag1 = "positive"
|
||||
sMag2 = "+12A"
|
||||
else:
|
||||
sMag1 = "negative"
|
||||
sMag2 = "-12A"
|
||||
output_file_Log = output_path+"Log_"+file_prefix+".dat"
|
||||
Logout = open(output_file_Log, "a+")
|
||||
sLogout = "Scan_number: "+file_prefix+"_"+suffix+line_sep+"Settings: "+Element+", "+str(E1)+"-"+str(E2)+", "+str(TIME)+" min, "+str(OFFSET1)+", "+str(OFFSET2)+", "+pol_str+", ES="+str(ES.getValue())+", PGM:"+Grating.getValue()+", cff="+str(cff.getValue())+line_sep+"Positions: X="+str(TRX.getValue())+", Y="+str(TRY.getValue())+", Z="+str(TRZ.getValue())+", THT="+str(THT.getValue())+line_sep+"Temperature at start of the scan: "+str(T_start)+" and at the end of the scan: "+str(T_end)+line_sep
|
||||
sLogout = "Scan_number: "+file_prefix+"_"+suffix+line_sep+"Sample " + Sample + " Magnetized in " + sMag1 +" direction" + line_sep
|
||||
sLogout = sLogout +"Settings: "+Element+", "+str(E1)+"-"+str(E2)+", "+str(TIME)+" min, "+str(OFFSET1)+", "+str(OFFSET2)+", "+pol_str+", ES="+str(ES.getValue())+", PGM:"+Grating.getValue()+", cff="+str(cff.getValue())+line_sep+"Positions: X="+str(TRX.getValue())+", Y="+str(TRY.getValue())+", Z="+str(TRZ.getValue())+", THT="+str(THT.getValue())+line_sep+"Temperature at start of the scan: "+str(T_start)+" and at the end of the scan: "+str(T_end)+line_sep
|
||||
sLogout = sLogout + "-------------------------------------------------------------------------------------------------------------"+line_sep
|
||||
Logout.write(sLogout)
|
||||
Logout.close()
|
||||
print "Log file updated"
|
||||
|
||||
output_file_Control = output_path+file_prefix+".dat"
|
||||
Control = open(output_file_Control, "a+")
|
||||
sControl = suffix + " " + suffix + " " + Sample + " " + Element + " " + sMag2 + line_sep
|
||||
Control.write(sControl)
|
||||
Control.close()
|
||||
print "Control file updated"
|
||||
|
||||
if RUNTYPE in ["+/-", "LH/LV"]:
|
||||
if polswitch == 1:
|
||||
switchpol(2, RUNTYPE) # tune ID2 --> polarization: C- or LV
|
||||
|
||||
Reference in New Issue
Block a user