This commit is contained in:
gac-x11ma
2019-08-05 15:26:17 +02:00
parent 67a38edfb4
commit d600f2e5b7
19 changed files with 944 additions and 26 deletions
+36 -4
View File
@@ -31,7 +31,7 @@ VG13_SET = "X11MA-EPS-VG13:SET"
VG13_GET = "X11MA-OP-VG13:OPEN"
"""
MAG ="X11MA-XMCD:Ireadout"
LPP_DELAY = "X11MA-ES2-4CHT:SET2-DELAY"
LPP_FINE_DELAY = "X11MA-ES2-4CHT:SET2-FINE"
TIME_DELAY_SET = "X11MA-ES2:Theta-New.A"
@@ -171,8 +171,8 @@ def convert_file(input_file_name, output_file_name, pol = None):
lines = inp.readlines()
with open(output_file_name, "wb") as out:
(db, st) = ("java.lang.Double", "java.lang.String")
out.write("#Energy" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "NORMtey" + sep + "NORMdiode" + sep + "Pol" + line_sep)
out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + st + line_sep)
out.write("#Energy" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + line_sep)
s = sep
for line in lines[1:]:
line = line.strip()
@@ -182,7 +182,39 @@ def convert_file(input_file_name, output_file_name, pol = None):
normtey=repr( float(CADC2)/float(CADC1))
normdiode=repr(float(CADC3)/float(CADC1))
#field=caget(MAG)
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + normtey + s + normdiode + s + str(pol) + line_sep)
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
#os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
def convert_file_full(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 + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + st + 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, MCurr, cffrbk, IDErbk, time) = line.split(" ")
normtey=repr( float(CADC2)/float(CADC1))
normdiode=repr(float(CADC3)/float(CADC1))
CADC5=repr(0.0)
mcurr=repr(machine_cur.read())
fieldx=repr(field.read())
fieldz=repr(0.0)
temp=repr(Temp.read())
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + mcurr + s + time + s + fieldx + s + fieldz + s + str(pol) + s + temp + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
#os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))