def add_contour(filename, ls, cmap='cool', chop=False): f = open(filename, 'rb') data = pickle.load(f) f.close() this_chi = np.array(data["chi2s"]) evs = [0.5, 1.0, 3.0, 10.0] count = 0 for ev in evs: which_sliver = get_loc(ev, msqs) temp = np.zeros(shape=(2, len(theta24s), len(theta34s))) for t24 in range(len(theta24s)): for t34 in range(len(theta34s)): temp[0][t24][t34] = this_chi[t24][t34][which_sliver[0]] temp[1][t24][t34] = this_chi[t24][t34][which_sliver[1]] final_chi = get_closest(ev, [msqs[which_sliver[0]], msqs[which_sliver[1]]], temp) if chop: # need to chop off the right side :frown: for i_x in range(len(scale_x)): for i_y in range(len(scale_y[i_x])): if final_chi[i_x][i_y] < 0 or final_chi[i_x][i_y] > 1000: final_chi[i_x][i_y] = None if scale_x[i_x][i_x] > 6e-2: final_chi[i_x][i_y] = None ct = plt.contour(scale_x, scale_y, final_chi.transpose(), levels=chis_l, cmap=cmap, linestyles=ls) ct.collections[0].set_color(get_color(count + 1, len(evs) + 1, "magma")) suffix = "Joint" if chop else "Cascades" ct.collections[0].set_label("{}, {:.1f}".format(suffix, ev) + r"eV$^{2}$") count += 1 return ct
plt.xlabel(r"$\left|U_{\mu 4}\right|^{2}=\sin^{2}\theta_{24}$") plt.ylabel(r"$\left| U_{\tau 4}\right|^{2}=\sin^{2}\theta_{34}\cdot\cos^{2}\theta_{24}$") # plt.ylabel(r"$\sin^{2}2\theta_{34}$",size=14) #plt.plot(t24s, scaled_minos_34, color='k', label="Minos") #plt.plot(super_k[0], super_k[1], color=get_color(1,4,cmap="magma"), label="Super K") #plt.plot(deepcore[0], deepcore[1], color=get_color(2,4,"magma"), label="DeepCore") #plt.plot(antares[0], antares[1], color=get_color(3,4,"magma"), label="KM3NeT/ORCA NO") ct = plt.contour(scale_x, scale_y, chis.transpose(), levels=chis_l, cmap='cool',linestyles='dashed') print(np.nanmin(chis)) mindices = np.nanargmin(chis) x,y = np.unravel_index(mindices, shape=np.shape(chis)) print(x,y) if ev==4.64: plt.scatter(np.sin(theta24s[x])**2, (np.cos(theta24s[x])**2)*(np.sin(theta34s[y])**2), s=80, marker=(5,1), color=get_color(color_count, len(evs)+1, "magma")) print(theta24s[x], theta34s[y]) #set_lbls(ct, [str(ev)+r"eV$^{2}$"], get_color(color_count, len(evs), "viridis")) ct.collections[0].set_color(get_color(color_count, len(evs)+1, "magma")) ct.collections[0].set_label("{}".format(ev) + r" eV$^{2}$") #plt.vlines(x=scaled_minos_24, ymin=0, ymax=scaled_minos_34[-1], color='k') plt.xlim([5e-3,0.2]) plt.xscale('log') plt.yscale('log') plt.ylim([9e-3, 5e-1]) plt.tight_layout()
#chis = chis - np.nanmin(chis) if count == 5: plt.pcolormesh(scale_x, scale_y, chis.transpose(), vmin=0, vmax=25, cmap='PuBu') count += 1 if msqs[msq] == 1.0 and theta24s[th24] == 0.3826: p1 = (0.853393, 0.00693782) p2 = (0.87203, 0.00814776) plt.plot([p1[0], p2[0]], [p1[1], p2[1]], color=get_color(2 + msq, 5, 'magma'), ls='-') ct = plt.contour(scale_x, scale_y, chis.transpose(), levels=chis_l, linestyles=linestyle) ct.collections[0].set_color(get_color(2 + msq, 5, 'magma')) ct.collections[0].set_label("{:.1f} eV".format(msqs[msq]) + r"$^{2}$, $\theta_{24}=$" + "{:.2f}".format(theta24s[th24])) plt.plot(scale_x[minloc[0]][minloc[0]], scale_y[minloc[1]][minloc[1]], marker="*",
e_grid = np.logspace(log10(emin), log10(emax), npoints) evaled = {} evaled_pg = {} mag = 1 counter = 0 for cid in stuff.keys(): cast = int(cid) n_nucl = hg.Z_A(cast)[1] #number of nucleons evaled[cast] = [hg.nucleus_flux(cast, e*n_nucl) for e in e_grid] evaled_pg[cast] = [pg.nucleus_flux(cast, e*n_nucl) for e in e_grid] plt.plot(e_grid, evaled[cast]*(e_grid**mag), label=stuff[cid], color=get_color(counter, len(list(stuff.keys()))-1), ls='-') # plt.plot(e_grid, evaled_pg[cast]*(e_grid**mag), color=get_color(counter, len(list(stuff.keys()))-1), ls='--') counter+=1 plt.xscale('log') plt.yscale('log') #plt.ylim([10**-1,10**4]) plt.xlabel(r"$E_{kinetic}$ [GeV/nucleon]", size=16) plt.ylabel(r"E $dN/dE$", size=16) plt.legend(prop={'size':14}) plt.tight_layout() plt.show()
if i34 == 0: ls = 'solid' elif i34 == 1: ls = 'dotted' else: ls = '' elif i24 == 1: if i34 == 0: ls = '-.' elif i34 == 1: ls = (0, (5, 10)) else: ls = 'dashdot' for ims in range(len(msqs)): color = get_color(ims, 4, "magma") llh_cut = [chis[i14][i24][i34][ims] for i14 in range(len(th14s))] label = r"$\theta_{24}$: " + "{:.2f}, ".format(th24s[i24]) label += r"$\theta_{34}$: " + "{:.2f}, ".format(th34s[i34]) label += r"$\Delta m_{41}^{2}$: " + "{:.2f}".format(msqs[ims]) plt.plot(np.sin(th14s)**2, llh_cut, ls=ls, color=color) title_1 = r"\textbf{Mixing Angles: }" title_2 = r"\textbf{Mass-Squared: }" #title_2 = r"$ \Delta m_{41}^{2}:$" all_labels = [title_1] plt.gca().add_line(plt.Line2D([], [], color="none", label=title_1)) plt.plot([], [], color='black',
# plt.figure(figsize=(9.5/1.5,9.34/1.5)) plt.xscale('log') #plt.title("At {:.2f} eV".format(ev if interp else msqs[which_sliver[0]]) +r"$^{2}$") # plt.yscale('log') plt.ylim([0.00, 0.30]) plt.xlim([1e-3, 0.5]) plt.xlabel(r"$\left|U_{\mu 4}\right|^{2}=\sin^{2}\theta_{24}$") plt.ylabel( r"$\left| U_{\tau 4}\right|^{2}=\sin^{2}\theta_{34}\cdot\cos^{2}\theta_{24}$" ) # plt.ylabel(r"$\sin^{2}2\theta_{34}$",size=14) #plt.plot(t24s, scaled_minos_34, color='k', label="Minos") plt.plot(super_k[0], super_k[1], color=get_color(1, 4, cmap="magma"), label="Super K") plt.plot(deepcore[0], deepcore[1], color=get_color(2, 4, "magma"), label="DeepCore") #plt.plot(antares[0], antares[1], color=get_color(3,4,"magma"), label="KM3NeT/ORCA NO") new_color = np.array((255, 157, 0)) / 256. ct = add_contour( "/home/bsmithers/software/data/hg_sib/0.0/joint_likelihood_0.0_0.0_0.0_0.0.dat", '--', 'cool', True) ct.collections[0].set_label("Joint Fit") ct.collections[0].set_color(new_color) ct = add_contour(
#plt.plot(yellow_right_interp, msqs) plt.gca().add_line(plt.Line2D([], [], color="none", label=title_2)) ct = plt.contour(si2(theta24s), msqs, chis.transpose(), levels=[-2 * log(0.10)], cmap='Oranges_r') ct8 = plt.contour(si2(t24_8), msqs_8, chis8.transpose(), levels=[-2 * log(0.10)], cmap='Oranges_r') all_labels += [title_2, "1 year", "8 years"] ct.collections[0].set_label("1 year") ct.collections[0].set_color(get_color(2, 4, 'Oranges')) ct8.collections[0].set_label("8 years") ct8.collections[0].set_color(get_color(4, 4, 'Oranges')) plt.xlim([0.001, 1]) plt.ylim([0.01, 10]) #set_lbls(ct) plt.xscale('log') plt.yscale('log') # plt.title(r"90% CL Sensitivity from Tracks", size=14) #plt.text(2,25, "Smithers Preliminary", color="r",size=14) plt.ylabel(r"$\Delta m_{14}^{2}$ [eV$^{2}$]", size=18) plt.xlabel(r"$\sin^{2}(2\theta_{24})$", size=18) def reorderLegend(ax=None, order=None): handles, labels = ax.get_legend_handles_labels()
mu_flux = np.sum(mu_flux, 1) * z_width mubar_flux = np.sum(mubar_flux, 1) * z_width return (mu_flux, mubar_flux) e_flux, mu_flux, tau_flux = get_flux(filename) pe_flux, pmu_flux, ptau_flux = get_flux( os.path.join(folders[1], config["mceq_flux"])) if not contour: plt.plot(energies, e_flux, label=r"HG2012 $\nu_{e}$", ls='-', color=get_color(0, 3, 'plasma')) plt.plot(energies, mu_flux, label=r"HG2012 $\nu_{\mu}$", ls='-', color=get_color(1, 3, 'plasma')) plt.plot(energies, tau_flux, label=r"HG2012 $\nu_{\tau}$", ls='-', color=get_color(2, 3, 'plasma')) plt.plot(energies, pe_flux, label=r"Poly $\nu_{e}$", ls='--',
cbar = plt.colorbar() cbar.set_label("New Fudge") plt.show() if not do_fudge: e_range = np.logspace(2, 8, 1000) a_edges = np.linspace(-1, 1, 11) e_edges = np.logspace(2, 8, 21) for flav in flavors: fig = plt.figure() i_count = 0 for fit in master_fit.fits[flav]: ys = fit(e_range) plt.plot(e_range, ys, color=get_color(i_count, 9)) i_count += 1 plt.title(flav, size=16) plt.xscale('log') plt.yscale('log') plt.xlim([1e2, 1e8]) #plt.ylim([1e-2,1e3]) plt.show() values = np.zeros(shape=(20, 10)) # now the integrated area plot for i_e in range(len(e_edges) - 1): for i_a in range(len(a_edges) - 1): values[i_e][i_a] = log10( dblquad(lambda e, a: master_fit(e, a, flav), a=a_edges[i_a],