Automatic commit. Thu Sep 6 00:00:05 WST 2012
[matches/honours.git] / research / TCS / process.py
index 9254c17..bc2aae0 100755 (executable)
@@ -59,17 +59,19 @@ def main():
        tcs = []
        gnuplot("set style data lp")
        gnuplot("set key outside right")
-       gnuplot("set title \"Au on Si (95min 3.5A 3-6 e-8mbar)\"")
-       gnuplot("set xlabel \"E (DAC Counts)\"")
-       gnuplot("set ylabel \"S(E) (ADC/DAC Counts)\"")
+       #gnuplot("set title \"Au on Si (50min 3.5A 3-6 e-8mbar)\"")
+       #gnuplot("set xlabel \"E (DAC Counts)\"")
+       #gnuplot("set ylabel \"S(E) (ADC/DAC Counts)\"")
        #gnuplot("set term postscript colour")
        #gnuplot("set output \"test.eps\"")
        for i in range(1, len(sys.argv)):
-               tcs.append(GetTCS(GetData(sys.argv[i])))
+               tcs.append(map(lambda e : [e[1], e[2]], GetData(sys.argv[i])))
+               #tcs.append(GetTCS(GetData(sys.argv[i])))
                if (len(tcs[i-1]) > 0):
-                       gnuplot.replot(Gnuplot.Data(tcs[i-1], title=sys.argv[i], with_="p"))
+                       gnuplot.replot(Gnuplot.Data(tcs[i-1], title="", with_="lp"))
 
-       # Now average the TCS data
+       # Now average the data
+       
        avg = odict.odict()
        for t in tcs:
                for p in t:
@@ -83,11 +85,14 @@ def main():
                avg[a] = float(avg[a][0]) / float(avg[a][1])
        
        
-       gnuplot.replot(Gnuplot.Data(sorted(avg.items(), key = lambda e : e[0]), title="Average", with_="l lw 4"))
-       
+       gnuplot.replot(Gnuplot.Data(sorted(avg.items(), key = lambda e : e[0]), title="Average", with_="l lw 2"))
        
-       print("Press enter to exit")
-       sys.stdin.readline()
+       sys.stdout.write("Save averaged data as (blank for no save): ")
+       filename = sys.stdin.readline().strip(" \r\n\t")
+       if (filename != ""):
+               out = open(filename, "w", 0)
+               for a in sorted(avg.items(), key = lambda e : e[0]):
+                       out.write(str(a[0]) + "\t" + str(a[1]) + "\n")
                
        return 0
 

UCC git Repository :: git.ucc.asn.au