logger = logging.getLogger('raytracing') from pylab import setp import matplotlib.patches as patches fig = plt.figure(figsize=(2 * 11.5, 8.5)) sizer = 32 #### ## Ray Tracing ### fig.subplots_adjust(wspace=2.5) ax = fig.add_subplot(1, 2, 1) x1 = [-2382 * units.m, -1130. * units.m] # pulser position x2 = [0., -200. * units.m] # ARA antanna r = ray.ray_tracing_2D(medium.southpole_simple()) solution = r.find_solutions(x1, x2) dirY, dirZ = r.get_path(x1, x2, solution[0]['C0']) refY, refZ = r.get_path(x1, x2, solution[1]['C0']) ax.plot(-dirY / units.km, dirZ / units.km, '-', linewidth=5.0, color='royalblue', label=r'Direct Solution') ax.plot(-refY / units.km, refZ / units.km, '-', linewidth=5.0, color='firebrick',
1.0, 0.2, "N: " + str(len(zeniths)) + "\nmean: " + str(np.average(zeniths)) + "\nstd: " + str(np.std(zeniths))) plt.suptitle("neutrino direction") plt.savefig(os.path.join(plot_folder, 'neutrino_direction.pdf'), bbox_inches="tight") plt.clf() #plot difference between cherenkov angle and viewing angle # i.e., opposite to the direction of propagation. We need the propagation direction here, so we multiply the shower axis with '-1' shower_axis = -1.0 * hp.spherical_to_cartesian(theta, phi) viewing_angles_d = np.array( [hp.get_angle(x, y) for x, y in zip(shower_axis, launch_vectors[:, 0, 0])]) viewing_angles_r = np.array( [hp.get_angle(x, y) for x, y in zip(shower_axis, launch_vectors[:, 0, 1])]) # calculate correct chereknov angle for ice density at vertex position ice = medium.southpole_simple() n_indexs = np.array( [ice.get_index_of_refraction(x) for x in np.array([xx, yy, zz]).T]) rho = np.arccos(1. / n_indexs) weightsExt = weights for chan in range(1, len(launch_vectors[0])): viewing_angles_d = np.append( viewing_angles_d, np.array([ hp.get_angle(x, y) for x, y in zip(shower_axis, launch_vectors[:, chan, 0]) ])) viewing_angles_r = np.append( viewing_angles_r, np.array([ hp.get_angle(x, y)
cmap=plt.get_cmap('Blues'), weights=weights) cb = plt.colorbar(h[3], ax=ax) cb.set_label("weighted number of events") ax.set_aspect('equal') ax.set_xlabel("r [m]") ax.set_ylabel("z [m]") fig.tight_layout() mask = (zz < -2000 * units.m) & (rr < 5000 * units.m) for i in np.array(range(len(xx)))[mask]: # C0 = fin['ray_tracing_C0'][i][0][0] # C1 = fin['ray_tracing_C1'][i][0][0] print('weight = {:.2f}'.format(weights[i])) x1 = np.array([xx[i], yy[i], zz[i]]) x2 = np.array([0, 0, -5]) r = ray.ray_tracing(x1, x2, medium.southpole_simple()) r.find_solutions() C0 = r.get_results()[0]['C0'] x1 = np.array([-rr[i], zz[i]]) x2 = np.array([0, -5]) r2 = ray.ray_tracing_2D(medium.southpole_simple()) yyy, zzz = r2.get_path(x1, x2, C0) launch_vector = fin['launch_vectors'][i][0][0] print(launch_vector) zenith_nu = fin['zeniths'][i] print(zenith_nu / units.deg) fig, ax = plt.subplots(1, 1) ax.plot(-rr[i], zz[i], 'o') ax.plot([-rr[i], -rr[i] + 100 * np.cos(zenith_nu)], [zz[i], zz[i] + 100 * np.sin(zenith_nu)], '-C0')