--- /dev/null
+#!/usr/bin/python -u
+
+#
+# @file process.py
+# @purpose Process TCS data
+# Takes S(E) = dI/dE
+# @author Sam Moore
+# @date August 2012
+#
+
+import sys
+import os
+import re # Regular expressions - for removing comments
+import odict #ordered dictionary
+
+def main():
+
+ if (len(sys.argv) != 2):
+ sys.stderr.write(sys.argv[0] + " - Require 1 argument (filename)\n")
+ return 1
+
+ input_file = open(sys.argv[1], "r")
+ data = odict.odict([])
+ for line in input_file:
+ line = re.sub("#.*", "", line).strip("\r\n ")
+ if len(line) == 0:
+ continue
+ line = line.split("\t")
+ #sys.stdout.write(str(line))
+ if float(line[1]) in data:
+ data[float(line[1])].append(float(line[2]))
+ else:
+ data[float(line[1])] = [float(line[2])]
+
+
+ for dac in data.keys():
+ avg = sum(data[dac], 0.0) / len(data[dac])
+ data[dac] = avg
+
+
+ result = []
+ for i in range(0, len(data.keys())-1):
+ dE = data.keys()[i+1] - data.keys()[i]
+ dI = data[data.keys()[i+1]] - data[data.keys()[i]]
+ result.append((data.keys()[i], dI/dE))
+ sys.stdout.write(str(data.keys()[i]) + "\t" + str(data[data.keys()[i]]) + "\t" + str(dI/dE) + "\n")
+
+ #for dac in data:
+ # sys.stdout.write(str(dac) + "\t" + str(data[dac]) + "\n")
+
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())