5 # @purpose Do theory stuff
6 # Because sadly, Mathematica does not work on my new laptop
14 import re # Regular expressions - for removing comments
15 #import odict #ordered dictionary
17 import Gnuplot, Gnuplot.funcutils
19 gnuplot = Gnuplot.Gnuplot()
24 # @purpose Model the secondary electron distribution using M. Furman's formula
26 def se_dist(s, Ep, sigma_p, dE, n_max=0.75):
30 results.append([E, n_max *s * E / (s - 1.0 + E**s) , math.exp(-(E - Ep)**2.0 / (2.0*sigma_p**2.0))])
35 # @function write_data
36 # @purpose Write a list of data to a file suitable for gnuplotting
38 def write_data(data, fileName):
39 out = open(fileName, "w")
42 out.write(str(column) + "\t")
52 test = se_dist(4.0, 7.0, 0.2, 0.01)
53 #gnuplot.replot(map(lambda e : [e[0], e[1] + e[2]], test))
54 #gnuplot.replot(map(lambda e : [e[0], e[2]], test))
55 write_data(test, "se_dist.dat")
57 print("Press enter to exit")
63 if __name__ == "__main__":