Automatic commit. Sat Sep 8 00:00:03 WST 2012
[matches/honours.git] / research / TCS / process.py
index 1e68296..452b280 100755 (executable)
@@ -28,6 +28,24 @@ def GetData(filename):
                data.append(map(lambda e : float(e), line.split("\t")))
        return data
 
+def DoNothing(data):
+       return data
+
+def GetDataSets(directory=".", function=DoNothing):
+       dirs = {}
+       for f in os.listdir(directory):
+               if os.path.isdir(directory+"/"+str(f)) == True:
+                       data_set = []
+                       for datafile in os.listdir(directory+"/"+str(f)):
+                               if datafile.split(".")[1] == "dat":
+                                       data_set.append(function(map(lambda e : [e[1], e[2]], GetData("./"+str(f)+"/"+str(datafile)))))
+
+                       avg = Average(data_set)
+                       dirs.update({f : avg})
+       return dirs
+
+
+
 def Derivative(data, a=0, b=1):
        result = []
        n = 0
@@ -114,7 +132,7 @@ def main():
        #gnuplot("set term postscript colour")
        #gnuplot("set output \"test.eps\"")
        for i in range(1, len(sys.argv)):
-               tcs.append(MaxNormalise(map(lambda e : [e[1], e[2]], GetData(sys.argv[i]))))
+               tcs.append(Derivative(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_="lp"))

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