diff --git a/script/EnergyMultiScan.py b/script/EnergyMultiScan.py index 894c4a7..5d25d1c 100644 --- a/script/EnergyMultiScan.py +++ b/script/EnergyMultiScan.py @@ -1,6 +1,3 @@ - -#print "Running Energy scan script with arguments: E1=", sys.argv[0], " E2= ", sys.argv[1], " Time= ", sys.argv[2], " Delay= ", sys.argv[3] - file_prefix = time.strftime("%Y%m%d") # CHANGE THE PATH IN THE OTH input_path = "/sls/X11MA/data/X11MA/Desktop/e17174/Sample01_Au_ref/"+file_prefix+"/" @@ -12,10 +9,7 @@ E1 = sys.argv[0] E2 = sys.argv[1] TIME = sys.argv[2] DELAY = sys.argv[3] -#E1 = 801 -#E2 = 810 -#TIME = 1 -#DELAY = 0 + number_of_scans = 1 ID1=0 ID2=1 @@ -49,9 +43,6 @@ def _startPlot(type): s = p.getSeries(0) cur = 0 time.sleep(3.0) - TEY = [] - dE1 = 0.0 - dE2 = 0.0 t_start = time.time() t_end = time.time() + TIME*60.0 while running: @@ -61,30 +52,6 @@ def _startPlot(type): break e = energy.read() - #time.sleep(0.0001) - ID1 = ID1_En.read() - ID2 = ID2_En.read() - #dE1 = ID1_En.read() - energy.read() - #dE2 = ID2_En.read() - energy.read() - aK1=keithley_1a.read() - aK2=keithley_2a.read() - aK3=keithley_3a.read() - aK1raw=Keithley_1_raw.read() - aK2raw=Keithley_2_raw.read() - aK3raw=Keithley_3_raw.read() - aTEYnorm=aK2/aK1 - TEY.append(line_sep) - TEY.append(e) - TEY.append(ID1) - TEY.append(ID2) - TEY.append(aTEYnorm) - TEY.append(aK1) - TEY.append(aK2) - TEY.append(aK3) - TEY.append(pol_str) - TEY.append(aK1raw) - TEY.append(aK2raw) - TEY.append(aK3raw) if (abs(e-cur)) > 0.1: v = abs((keithley_2a.read() / ((keithley_1a if (type==1) else keithley_3a).read() ))) s.appendData(e,v) @@ -131,7 +98,6 @@ mag_str = None pol_str = None polswitch = 1 -#fid = get_next_fid(input_path, "o" + file_prefix) fid = get_next_fid(input_path, "o" + file_prefix) @@ -223,12 +189,11 @@ for scan_no in range(number_of_scans): caput(OTF_ESET, E1) T_end = Temp.getValue() time.sleep(5.0) - #TODO: wait for file instead of sleep #Convert file output_file = output_path + "os" + file_prefix + "_" + suffix + ".dat" print("Converting data file: " + output_file); - convert_file(input_file, output_file, mag_str, pol_str) + convert_file(input_file, output_file, mag_str, pol_str, True) 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) diff --git a/script/local.py b/script/local.py index b2a15f5..9ec69e2 100644 --- a/script/local.py +++ b/script/local.py @@ -66,7 +66,7 @@ def convert_file(input_file_name, output_file_name, field = 0, pol = 0, keithley with open(input_file_name) as inp: lines = inp.readlines() with open(output_file_name, "wb") as out: - out.write("Energy" + sep + "rbkenergy" + sep + "Mag" + sep + "Pol" + sep + "Io" + sep + "TEY" + sep + "Norm" + line_sep) + out.write("Energy" + sep + "rbkenergy" + sep + "Mag" + sep + "Pol" + sep + "Io" + sep + "CADC2" + sep + "Norm/CADC3" + line_sep) s = sep + " " #File format has a space before numeric values for line in lines[1:]: line = line.strip() @@ -74,7 +74,7 @@ def convert_file(input_file_name, output_file_name, field = 0, pol = 0, keithley try: (Ecrbk,CADC1, CADC2, NORM, CADC3, CADC4, MCurr, cffrbk, ID1Erbk, ID2Erbk, vTime) = line.split(" ") #out.write(Ecrbk + sep + Ecrbk + sep + str(field) + sep + str(pol) + sep + CADC1 + sep + CADC2 + sep + (CADC3 if keithley_3 else NORM) + line_sep) - out.write(" " + Ecrbk + s + Ecrbk + s + str(field) + s + str(pol) + s + CADC1 + s + CADC2 + s + (CADC3 if keithley_3 else NORM) + line_sep) + out.write(Ecrbk + s + str(field) + s + str(pol) + s + CADC1 + s + CADC2 + s + (CADC3 if keithley_3 else NORM) + line_sep) except: traceback.print_exc()