Closedown
This commit is contained in:
+18
-4
@@ -3,7 +3,7 @@
|
||||
###################################################################################################
|
||||
|
||||
NO_BEAM_CHECK = False # setting this to true disables the waiting for the beam before starting energy or hyst scan
|
||||
|
||||
"""
|
||||
OTF_START = "X11MA-OTF:GO"
|
||||
OTF_E1 = "X11MA-OTF:E1"
|
||||
OTF_E2 = "X11MA-OTF:E2"
|
||||
@@ -16,9 +16,10 @@ ID2_MODE = "X11MA-ID2:MODE"
|
||||
ID1_ALPHA = "X11MA-ID1:ALPHA"
|
||||
ID2_ALPHA = "X11MA-ID2:ALPHA"
|
||||
ID1_OFF = "X11MA-ID1:ENERGY-OFFS"
|
||||
ID2_OFF = "X11MA-ID2:ENERGY-OFFS"
|
||||
ALL_DONE = "X11MA-PHS:ALL-DONE"
|
||||
ID2_OFF = "X11MA-ID2:ENERGY-OFFS"
|
||||
ENERGY_SP = "X11MA-PHS:E_SP"
|
||||
"""
|
||||
ALL_DONE = "X11MA-PHS:ALL-DONE"
|
||||
VG10_SET = "X11MA-EPS-VG10:SET"
|
||||
VG10_GET = "X11MA-OP-VG10:OPEN"
|
||||
VG11_SET = "X11MA-EPS-VG11:SET"
|
||||
@@ -27,6 +28,7 @@ VG12_SET = "X11MA-EPS-VG12:SET"
|
||||
VG12_GET = "X11MA-OP-VG12:OPEN"
|
||||
VG13_SET = "X11MA-EPS-VG13:SET"
|
||||
VG13_GET = "X11MA-OP-VG13:OPEN"
|
||||
"""
|
||||
LPP_DELAY = "X11MA-ES2-4CHT:SET2-DELAY"
|
||||
LPP_FINE_DELAY = "X11MA-ES2-4CHT:SET2-FINE"
|
||||
TIME_DELAY_SET = "X11MA-ES2:Theta-New.A"
|
||||
@@ -35,7 +37,7 @@ TIME_DELAY_START = "X11MA-ES2:SCAN-START"
|
||||
TIME_DELAY_COMPLETE = "X11MA-ES2-scan1.SMSG"
|
||||
TBT_MAG = "X11MA-LSCI632:MFIELD"
|
||||
MAG="X11MA-XMCD:Ireadout"
|
||||
|
||||
"""
|
||||
def get_next_fid(folder, prefix):
|
||||
try:
|
||||
import glob
|
||||
@@ -139,4 +141,16 @@ def before_sample():
|
||||
def after_sample():
|
||||
check_id_error()
|
||||
|
||||
###################################################################################################
|
||||
#OTF function
|
||||
###################################################################################################
|
||||
def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, name = None):
|
||||
"""
|
||||
"""
|
||||
if name is None:
|
||||
name = get_exec_pars().name
|
||||
folder = get_context().setup.expandPath("{year}_{month}/{date}");
|
||||
|
||||
run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
|
||||
|
||||
|
||||
|
||||
+23
-4
@@ -3,7 +3,7 @@
|
||||
###################################################################################################
|
||||
|
||||
NO_BEAM_CHECK = False # setting this to true disables the waiting for the beam before starting energy or hyst scan
|
||||
|
||||
"""
|
||||
OTF_START = "X11MA-OTF:GO"
|
||||
OTF_E1 = "X11MA-OTF:E1"
|
||||
OTF_E2 = "X11MA-OTF:E2"
|
||||
@@ -16,9 +16,10 @@ ID2_MODE = "X11MA-ID2:MODE"
|
||||
ID1_ALPHA = "X11MA-ID1:ALPHA"
|
||||
ID2_ALPHA = "X11MA-ID2:ALPHA"
|
||||
ID1_OFF = "X11MA-ID1:ENERGY-OFFS"
|
||||
ID2_OFF = "X11MA-ID2:ENERGY-OFFS"
|
||||
ALL_DONE = "X11MA-PHS:ALL-DONE"
|
||||
ID2_OFF = "X11MA-ID2:ENERGY-OFFS"
|
||||
ENERGY_SP = "X11MA-PHS:E_SP"
|
||||
"""
|
||||
ALL_DONE = "X11MA-PHS:ALL-DONE"
|
||||
VG10_SET = "X11MA-EPS-VG10:SET"
|
||||
VG10_GET = "X11MA-OP-VG10:OPEN"
|
||||
VG11_SET = "X11MA-EPS-VG11:SET"
|
||||
@@ -27,6 +28,7 @@ VG12_SET = "X11MA-EPS-VG12:SET"
|
||||
VG12_GET = "X11MA-OP-VG12:OPEN"
|
||||
VG13_SET = "X11MA-EPS-VG13:SET"
|
||||
VG13_GET = "X11MA-OP-VG13:OPEN"
|
||||
"""
|
||||
LPP_DELAY = "X11MA-ES2-4CHT:SET2-DELAY"
|
||||
LPP_FINE_DELAY = "X11MA-ES2-4CHT:SET2-FINE"
|
||||
TIME_DELAY_SET = "X11MA-ES2:Theta-New.A"
|
||||
@@ -35,7 +37,7 @@ TIME_DELAY_START = "X11MA-ES2:SCAN-START"
|
||||
TIME_DELAY_COMPLETE = "X11MA-ES2-scan1.SMSG"
|
||||
TBT_MAG = "X11MA-LSCI632:MFIELD"
|
||||
MAG="X11MA-XMCD:Ireadout"
|
||||
|
||||
"""
|
||||
def get_next_fid(folder, prefix):
|
||||
try:
|
||||
import glob
|
||||
@@ -122,4 +124,21 @@ def wait_beam():
|
||||
sleep(0.1)
|
||||
print "Beam OK."
|
||||
|
||||
def is_id_error():
|
||||
return (id_error.read()==0)
|
||||
|
||||
def check_id_error():
|
||||
if is_id_error():
|
||||
raise Exception ("ID error: check ID status")
|
||||
|
||||
###################################################################################################
|
||||
#Default scan callbacks
|
||||
###################################################################################################
|
||||
|
||||
def before_sample():
|
||||
pass
|
||||
|
||||
def after_sample():
|
||||
check_id_error()
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ time.sleep(DELAY)
|
||||
caput('START', '1')
|
||||
|
||||
try:
|
||||
#write_logs()
|
||||
|
||||
waiting = True
|
||||
def plot_task():
|
||||
@@ -146,8 +145,8 @@ try:
|
||||
raise Exception("Data file not found: " + name)
|
||||
|
||||
convert_file(name, newName)
|
||||
#log("Created data file: " + newName)
|
||||
#plot_file(newName)
|
||||
|
||||
plot_file(newName)
|
||||
print("Success")
|
||||
|
||||
except:
|
||||
|
||||
+32
-5
@@ -1,6 +1,6 @@
|
||||
|
||||
##################### Convert_File function #############################
|
||||
|
||||
"""
|
||||
def convert_file(input_file_name, output_file_name):
|
||||
sep = "\t"
|
||||
line_sep = "\r\n"
|
||||
@@ -18,9 +18,36 @@ def convert_file(input_file_name, output_file_name):
|
||||
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + str(field) +line_sep)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
"""
|
||||
def convert_file(input_file_name, output_file_name, pol = None):
|
||||
print "Converting data file: " + input_file_name + " to " + output_file_name
|
||||
#print "File converted to: ",output_file_name
|
||||
sep = "\t"
|
||||
line_sep = "\n"
|
||||
MODE = pol_mode.read()
|
||||
if pol is None:
|
||||
pol = pol_angle.read() if (MODE == "LINEAR") else pol_mode.readback.read()
|
||||
with open(input_file_name) as inp:
|
||||
lines = inp.readlines()
|
||||
with open(output_file_name, "wb") as out:
|
||||
(db, st) = ("java.lang.Double", "java.lang.String")
|
||||
out.write("#Energy" + sep + "Io" + sep + "CADC2" + sep + "CADC3" + sep + "NORMtey" + "Pol" + line_sep)
|
||||
out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + line_sep)
|
||||
s = sep
|
||||
for line in lines[1:]:
|
||||
line = line.strip()
|
||||
if line=="": break
|
||||
try:
|
||||
(Ecrbk, CADC1, CADC2, CADC3, CADC4, CADC5, MCurr, cffrbk, IDErbk, NORM, time, MAGX, MAGZ, EXPT) = line.split(" ")
|
||||
normtey=repr( float(CADC1)/float(CADC2))
|
||||
# normdiode=repr(float(CADC3)/float(CADC2))
|
||||
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + normtey + s + str(pol) + line_sep)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
|
||||
|
||||
##################### Plotting function #############################
|
||||
|
||||
"""
|
||||
task = None
|
||||
running = False
|
||||
|
||||
@@ -60,9 +87,9 @@ def stopPlot():
|
||||
running = False
|
||||
ret = join(task)
|
||||
|
||||
|
||||
"""
|
||||
##################### Switch Polarization function #############################
|
||||
|
||||
"""
|
||||
|
||||
def switchpol(activeID, runtype):
|
||||
global pol_str
|
||||
@@ -87,5 +114,5 @@ pol_str = None
|
||||
|
||||
def get_pol_str():
|
||||
return pol_str
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user