diff --git a/script/Diagnostics/WireScan.py b/script/Diagnostics/WireScan.py index 511e630..0bab30a 100644 --- a/script/Diagnostics/WireScan.py +++ b/script/Diagnostics/WireScan.py @@ -72,8 +72,9 @@ class w_pos(Readable): return scanner.get_sel_wire_pos(st.getChildren()[0].take()) #End of scan checking -scan_complete = None -cur_cycle = None +bkg_mean, bkg_sigma = None, None +scan_complete, cur_cycle, wire = None, None, None + def check_end_scan(record, scan): global scan_complete,cur_cycle if record[4]<1: @@ -92,6 +93,7 @@ def check_end_scan(record, scan): #Process background def do_background(): + global bkg_mean, bkg_sigma #Store Background if bkgrd>0: scanner.park(wait=True) @@ -99,16 +101,23 @@ def do_background(): r = mscan (st, st.getReadables()[4:], bkgrd) for i in range(len(r.getReadables())): d = r.getReadable(i) - m,s = mean(d), stdev(d) + bkg_mean, bkg_sigma = mean(d), stdev(d) path = get_exec_pars().group + "/"+ r.getReadables()[i].name - set_attribute(path, "Mean", m) - set_attribute(path, "Sigma", s) + set_attribute(path, "Mean", bkg_mean) + set_attribute(path, "Sigma", bkg_sigma) +def calculate(): + global cycles, wire + for i in range (cycles): + for blm in blms: + x =load_data(wire+"_" + ("%04d" % i+1) + blm ) + print x + #Scan def do_scan(index): - global scan_complete, cur_cycle + global scan_complete, cur_cycle, wire wire = "y" if (index==1) or (scan_type in [WireScanner.WireY1, WireScanner.WireY1]) else "x" set_exec_pars(group=wire+"_{count}", reset=True) scanner.set_selection(get_scan_selection(scan_type, index)) @@ -128,8 +137,8 @@ def do_scan(index): try: scanner.scan() #scanner.waitState(State.Busy, 60000) Not needed as stream filter will make the wait st.getChild("scanning").waitValue(1.0, 10000) - mscan (st, [w_pos()] + st.getReadables(), -1, -1, take_initial = True, after_read = check_end_scan) - + mscan (st, [w_pos()] + st.getReadables(), -1, -1, take_initial = True, after_read = check_end_scan) + calculate() except: if not scanner.isReady(): print "Aborting scan"