Initial tests of processing (calculate dI/dE)
authorSam Moore <[email protected]>
Mon, 20 Aug 2012 05:51:16 +0000 (13:51 +0800)
committerSam Moore <[email protected]>
Mon, 20 Aug 2012 05:51:16 +0000 (13:51 +0800)
Uncalibrated.

You know what? These results look like *SHIT*.

research/TCS/2012-08-20/processed.png [new file with mode: 0644]
research/TCS/process.py [new file with mode: 0755]

diff --git a/research/TCS/2012-08-20/processed.png b/research/TCS/2012-08-20/processed.png
new file mode 100644 (file)
index 0000000..a0470c5
Binary files /dev/null and b/research/TCS/2012-08-20/processed.png differ
diff --git a/research/TCS/process.py b/research/TCS/process.py
new file mode 100755 (executable)
index 0000000..c279759
--- /dev/null
@@ -0,0 +1,55 @@
+#!/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())

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