Closedown
This commit is contained in:
@@ -133,6 +133,53 @@ def before_sample():
|
||||
def after_sample():
|
||||
check_id_error()
|
||||
|
||||
##################### Convert_File function #############################
|
||||
"""
|
||||
def convert_file(input_file_name, output_file_name):
|
||||
sep = "\t"
|
||||
line_sep = "\r\n"
|
||||
field = caget('X11MA-XMCD:Ireadout')
|
||||
with open(input_file_name) as inp:
|
||||
lines = inp.readlines()
|
||||
with open(output_file_name, "wb") as out:
|
||||
out.write("Energy" + sep + "Io" + sep + "CADC2" + sep + "CADC3" + sep + "Mag" + line_sep)
|
||||
s = sep + " " #File format has a space before numeric values
|
||||
for line in lines[1:]:
|
||||
line = line.strip()
|
||||
if line=="": break
|
||||
try:
|
||||
(Ecrbk,CADC1, CADC2, NORM, CADC3, CADC4, MCurr, cffrbk, ID1Erbk, ID2Erbk, vTime) = line.split(" ")
|
||||
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 + "CADC1" + 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, MCurr, cffrbk, IDErbk, time) = line.split(" ")
|
||||
normtey=repr( float(CADC2)/float(CADC1))
|
||||
# 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)))
|
||||
|
||||
###################################################################################################
|
||||
#OTF function
|
||||
###################################################################################################
|
||||
|
||||
@@ -18,7 +18,7 @@ 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
|
||||
@@ -39,13 +39,13 @@ def convert_file(input_file_name, output_file_name, pol = None):
|
||||
if line=="": break
|
||||
try:
|
||||
(Ecrbk, CADC1, CADC2, CADC3, CADC4, MCurr, cffrbk, IDErbk, time) = line.split(" ")
|
||||
normtey=repr( float(CADC3)/float(CADC1))
|
||||
normtey=repr( float(CADC2)/float(CADC1))
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user