def plot_energy_ratios(): """A function to plot the energy ratios generated in the kinematics module throughout.""" E1s = kinematics.e1s.output() E2s = kinematics.e2s.output() E3s = kinematics.e3s.output() ratio1s, ratio2s = [], [] for i, x in enumerate(E1s): ratio1s.append([E2s[i] / E1s[i]]) ratio2s.append([E2s[i] / E3s[i]]) ratios1s = [ x[0] for (y, x) in sorted(zip(E2s, ratio1s), key=lambda pair: pair[0]) ] ratios2s = [ x[0] for (y, x) in sorted(zip(E2s, ratio2s), key=lambda pair: pair[0]) ] E2s.sort() pyplot.figure() pyplot.title(r"$The\ energy\ ratios\ produced\ throughout$") pyplot.xlabel(r"$E_{2}$") pyplot.ylabel(r"$Ratio E_{2}/E_{i}$") pyplot.yscale('log') pyplot.scatter(E2s, ratio1s, linewidth=2, label=r"$Ratio E_{2}/E_{1}$") pyplot.scatter(E2s, ratio2s, linewidth=2, label=r"$Ratio E_{2}/E_{3}$") pyplot.legend() assertions.show_graph()
def plot_xs(): """A function to plot x1 vs x3 generated in the kinematics module throughout.""" x1s = kinematics.tX1s.output() x3s = kinematics.tX3s.output() pyplot.figure() pyplot.xlabel(r"$x_{1}$", fontsize=22) pyplot.ylabel(r"$x_{3}$", fontsize=22) pyplot.xlim(-0.05, 1.05) pyplot.ylim(-0.05, 1.05) pyplot.xticks(fontsize=15) pyplot.yticks(fontsize=15) pyplot.scatter(x1s, x3s) assertions.show_graph()
def plot_xs(): """A function to plot x1 vs x3 generated in the kinematics module throughout.""" x1s = kinematics.tX1s.output() x3s = kinematics.tX3s.output() pyplot.figure() pyplot.xlabel(r"$x_{1}$",fontsize = 22) pyplot.ylabel(r"$x_{3}$",fontsize = 22) pyplot.xlim(-0.05,1.05) pyplot.ylim(-0.05,1.05) pyplot.xticks(fontsize = 15) pyplot.yticks(fontsize = 15) pyplot.scatter(x1s,x3s) assertions.show_graph()
def plot_energy_ratios(): """A function to plot the energy ratios generated in the kinematics module throughout.""" E1s = kinematics.e1s.output() E2s = kinematics.e2s.output() E3s = kinematics.e3s.output() ratio1s, ratio2s = [], [] for i, x in enumerate(E1s): ratio1s.append([E2s[i]/E1s[i]]) ratio2s.append([E2s[i]/E3s[i]]) ratios1s = [x[0] for (y,x) in sorted(zip(E2s,ratio1s), key=lambda pair: pair[0])] ratios2s = [x[0] for (y,x) in sorted(zip(E2s,ratio2s), key=lambda pair: pair[0])] E2s.sort() pyplot.figure() pyplot.title(r"$The\ energy\ ratios\ produced\ throughout$") pyplot.xlabel(r"$E_{2}$") pyplot.ylabel(r"$Ratio E_{2}/E_{i}$") pyplot.yscale('log') pyplot.scatter(E2s,ratio1s,linewidth = 2, label = r"$Ratio E_{2}/E_{1}$") pyplot.scatter(E2s,ratio2s,linewidth = 2, label = r"$Ratio E_{2}/E_{3}$") pyplot.legend() assertions.show_graph()
tDifferences.append(tAveragePhi - math.pi) pyplot.figure() pyplot.plot(tResults, color="blue", label=r"$Current\ value$") pyplot.plot(tSums[tSumsIndex], linewidth=2, color='black', label=r"$Average\ value$") pyplot.axhline(2.0 * math.pi, linestyle='--', color='red') pyplot.axhline(math.pi, linestyle='--', color='red') pyplot.axhline(tAveragePhi, linestyle='--', color='green') pyplot.title(r"$Random\ values\ of\ \phi\ for\ " + str(tiRange) + r"\ iterations$") pyplot.ylabel(r"$Random\ \phi\ (rad)$") pyplot.xlabel(r"$Iteration$") pyplot.legend() assertions.show_graph() if (tDifferences[1]**2 < tDifferences[0]**2): print "\nAverage closer to pi with more calls:: Test successful!" else: print "\nAverage convergence test unsuccessful, check on graphs!" print "\nFinished testing get_random_phi function." assertions.pause(__name__) ##Test get_random_theta function:## print "\n--------------------------------------------------\n" print "Testing get_random_theta function:\n" tRangeMultiplier = [1, 1000] tSums = [[0], [0]] tDifferences = [] for tSumsIndex, tm in enumerate(tRangeMultiplier): tResults = []
numberBins = int(numTestIts)/numberPerBin testQNames = [r"$\rm{d-quark}$",r"$\rm{u-quark}$",r"$\rm{s-quark}$",r"$\rm{c-quark}$",r"$\rm{b-quark}$",r"$\rm{t-quark}$"] numberS123s = 1000 testS123s = [i*testS123/(numberS123s-1.0) for i in range(0,numberS123s)][1:] ##Remove 0 where undefined. ##Test calc_real_chi:## print "\n--------------------------------------------------\n" print "Testing calc_real_chi:\n" realChis = [calc_real_chi(anS123) for anS123 in testS123s] pyplot.figure() pyplot.title(r"$Re(\chi)\ as\ a\ function\ of\ S_{123}$") pyplot.xlabel(r"$S_{123} (GeV^{2}/c^{4})$") pyplot.ylabel(r"$Re(\chi(S_{123}))$") pyplot.plot(testS123s,realChis,linewidth = 2, label = r"$Re(\chi(S_{123}))$") pyplot.legend() assertions.show_graph() print "\nFinished testing calc_real_chi." assertions.pause(__name__) ##Test calc_mod_squared_chi:## print "\n--------------------------------------------------\n" print "Testing calc_mod_squared_chi:\n" realChis = [calc_mod_squared_chi(anS123) for anS123 in testS123s] pyplot.figure() pyplot.title(r"$\|\chi\|^{2}\ as\ a\ function\ of\ S_{123}$") pyplot.xlabel(r"$S_{123} (GeV^{2}/c^{4})$") pyplot.ylabel(r"$\|\chi(S_{123})\|^{2}$") pyplot.plot(testS123s,realChis,linewidth = 2, label = r"$\|\chi(S_{123})\|^{2}$") pyplot.legend() assertions.show_graph() print "\nFinished testing calc_mod_squared_chi."