diff --git a/config/energy_scan.properties b/config/energy_scan.properties index 9120436..9b647d0 100644 --- a/config/energy_scan.properties +++ b/config/energy_scan.properties @@ -12,8 +12,8 @@ Ni=825.0;890.0;2.0;10.0;-9.0;-11.5 Ni Linear=825.0;890.0;2.0;10.0;-3.5;-5.5 O=500.0;560.0;2.0;10.0;-7.5;-8.5 Gd=1170.0;1240.0;2.0;10.0;-13.0;-11.5 -Cr=560.0;610.0;1.0;10.0;-7.5;-9.0 +Cr=560.0;610.0;2.0;10.0;-7.5;-9.0 Co=750.0;825.0;2.0;10.0;-9.5;-11.5 -Mn=620.0;670.0;2.0;10.0;-7.5;-8.1 +Mn=620.0;670.0;2.0;5.0;-7.5;-8.5 Fe=680.0;750.0;2.0;10.0;-8.0;-9.0 Fe Linear=680.0;750.0;2.0;10.0;1.2;2.9 diff --git a/script/EnergyScan.py b/script/EnergyScan.py index 5e7c40f..2f3e5e6 100644 --- a/script/EnergyScan.py +++ b/script/EnergyScan.py @@ -70,108 +70,48 @@ def _startPlot(type): s = p.getSeries(0) cur = 0 time.sleep(3.0) - MCP1 = [] - MCP2 = [] + TEY = [] + dE1 = 0.0 + dE2 = 0.0 + t_start = time.time() + t_end = time.time() + TIME*60.0 + #print t_start + # print t_end + #sTEYout = [] while running: try: - if otf_start.read() == 0: - break + #if (otf_start.read() == 0 or time.time() > t_end): + # break + cur_en = E1+(E2-E1)*(time.time()-t_start)/(TIME*60) + caput ("X11MA-PHS:E_SP",cur_en) e = energy.read() - t_start = time.time() - t_end = time.time()+TIME*60 - print t_start - print t_end - while time.time() <= t_end: - cur_en = E1+(E2-E1)*(time.time()-t_start)/(TIME*60) - caput ("X11MA-ID1:ENERGY",cur_en) - caput ("X11MA-ID2:ENERGY",cur_en) + cur_en1 = cur_en - dE1 + cur_en2 = cur_en - dE2 + #print cur_en + # print cur_en1 + #print cur_en2 + caput ("X11MA-ID1:ENERGY",cur_en1) + caput ("X11MA-ID2:ENERGY",cur_en2) + #while abs (e - cur_en) < 0.01: + # pass + #time.sleep(0.0001) ID1 = ID1_En.read() ID2 = ID2_En.read() - if (MCP_1 == 1 or MCP_2 == 1): - aK1=keithley_1a.read() - aK2=keithley_2a.read() - aK3=keithley_3a.read() - #aP=FillingPattern.read() - #aPr = [] - #for z in aP: - # aPr.append(z) - aPr = FillingPattern.read().tolist() - SumaP=0 - CamaP=0 - for z in xrange(0,480): - SumaP = SumaP + aPr[z] - for z in xrange(460,470): - CamaP = CamaP + aPr[z] - aK1norm = aK1 * CamaP / SumaP - if MCP_1 == 1: - #a1=MCPArray1.read() - #a1r = [] - #for i in a1: - # a1r.append(i) - a1r = MCPArray1.read().tolist() - Sum1a1 = 0 - Cam1a1 = 0 - Sum2a1 = 0 - Cam2a1 = 0 - MCP1.append(line_sep) - MCP1.append(e) - MCP1.append(ID1) - MCP1.append(ID2) - for i in xrange(0,480): - Sum1a1 = Sum1a1 + a1r[i] - for i in xrange(Cam_start,Cam_end+1): - Cam1a1 = Cam1a1 + a1r[i] - Cam1a1 = a1r[Cam_start] - - MCP1.append(Sum1a1) - MCP1.append(Cam1a1) - MCP1.append(aK1norm) - MCP1.append(aK1) - MCP1.append(aK2) - MCP1.append(aK3) - - if NrCounters.read() > 460: - for i in xrange(480,960): - Sum2a1 = Sum2a1 + a1r[i] - for i in xrange(Cam_start+480,Cam_end+481): - Cam2a1 = Cam2a1 + a1r[i] - Cam2a1 = a1r[Cam_start+480] - MCP1.append(Sum2a1) - MCP1.append(Cam2a1) - if Save_array_data == 1: - MCP1.append(a1r) - if MCP_2 == 1: - #a2=MCPArray2.read() - #a2r = [] - #for j in a2: - # a2r.append(j) - a2r = MCPArray2.read().tolist() - Sum1a2 = 0 - Cam1a2 = 0 - Sum2a2 = 0 - Cam2a2 = 0 - MCP2.append(line_sep) - MCP2.append(e) - for j in xrange(0,480): - Sum1a2 = Sum1a2 + a2r[j] - for j in xrange(Cam_start,Cam_end+1): - Cam1a2 = Cam1a2 + a2r[j] - Cam1a2 = a2r[Cam_end] - - MCP2.append(Sum1a2) - MCP2.append(Cam1a2) - MCP2.append(aK1norm) - if NrCounters.read() > 460: - for j in xrange(480,960): - Sum2a2 = Sum2a2 + a2r[j] - for j in xrange(Cam_start+480,Cam_end+481): - Cam2a2 = Cam2a2 + a2r[j] - Cam2a2 = a2r[Cam_end+481] - MCP2.append(Sum2a2) - MCP2.append(Cam2a2) - if Save_array_data == 1: - MCP2.append(a2r) - time.sleep(SamplingTime.read()*0.001) + #dE1 = ID1_En.read() - energy.read() + #dE2 = ID2_En.read() - energy.read() + aK1=keithley_1a.read() + aK2=keithley_2a.read() + aK3=keithley_3a.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) if (abs(e-cur)) > 0.1: v = abs((keithley_2a.read() / ((keithley_1a if (type==1) else keithley_3a).read() ))) s.appendData(e,v) @@ -180,32 +120,14 @@ def _startPlot(type): except: pass print "Done Plotting" - if MCP_1 == 1: - output_file_MCP1 = output_path+"MCP_1_"+file_prefix+"_" + suffix + ".dat" - MCP1out = open(output_file_MCP1, "a+") - sMCP1 = sep.join(str(x) for x in MCP1) + line_sep # MCP1.write("%s" + sep % i) - sMCP1out = sep + "rbkenergy" + sep + "Sum1" + sep + "Cam1" + sep + "Keithley1_norm" + sep + "Keithley1" + sep + "Keithley2" + sep + "Keithley3" - if NrCounters.read() > 460: - sMCP1out = sMCP1out + sep + "Sum2" + sep + "Cam2" - if Save_array_data == 1: - sMCP1out = sMCP1out + sep + "Array" - sMCP1out = sMCP1out + line_sep + sMCP1 - MCP1out.write(sMCP1out) - MCP1out.close() - print "Saved MCP signal data" - if MCP_2 == 1: - output_file_MCP2 = output_path+"MCP_2_"+file_prefix+"_" + suffix + ".dat" - MCP2out = open(output_file_MCP2, "a+") - sMCP2 = sep.join(str(y) for y in MCP2) + line_sep - sMCP2out = sep + "rbkenergy" + sep + "Sum1" + sep + "Cam1" + sep + "Keithley1_norm" - if NrCounters.read() > 460: - sMCP2out = sMCP2out + sep + "Sum2" + sep + "Cam2" - if Save_array_data == 1: - sMCP2out = sMCP2out + sep + "Array" - sMCP2out = sMCP2out + line_sep + sMCP2 - MCP2out.write(sMCP2out) - MCP2out.close() - print "Saved MCP I_0 data" + output_file_TEY = output_path+"TEY_"+file_prefix+"_" + suffix + ".dat" + TEYout = open(output_file_TEY, "a+") + sTEY = sep.join(str(x) for x in TEY) #+ line_sep # MCP1.write("%s" + sep % i) + sTEYout = "rbkenergy" + sep + "ID1_en" + sep + "ID2_en" + sep + "TEY_norm" + sep + "Keithley1" + sep + "Keithley2" + sep + "Keithley3"+ sep + "Polarisation" + sTEYout = sTEYout + line_sep + sTEY + TEYout.write(sTEYout) + TEYout.close() + print "Saved TEY signal data" def startPlot(type = 1): global task task = fork((_startPlot,(type,)),) @@ -243,10 +165,10 @@ mag_str = caget(MAG) pol_str = None polswitch = 1 +#fid = get_next_fid(input_path, "o" + file_prefix) fid = get_next_fid(input_path, "o" + file_prefix) - ############################################################################### #Prepare scan ############################################################################### @@ -297,10 +219,17 @@ open_vg12() time.sleep(0.5) open_vg13() +Log = [] + for scan_no in range(number_of_scans): suffix = ("%03d" % fid) input_file = input_path + "o" + file_prefix + "_" + suffix + ".dat" + # Log.append(scan_no+1) + #Log.append(posX) + + + caput(OTF_E1, E1) caput(OTF_E2, E2) caput(OTF_TIME, TIME)