Closedown

This commit is contained in:
gac-x11ma
2019-05-10 10:25:22 +02:00
parent dfc152eb6d
commit 38a87fdd4e
4 changed files with 75 additions and 16 deletions
+32 -5
View File
@@ -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
"""