def integrand2(theta, E, forward, x_min, x_max, sad): p1 = at.klein_nishina(E, theta) * 10e30 p2 = rd.continue_line(theta, sad, x_min, x_max) p3 = at.energy_limit_factor(E, theta, forward) p4 = at.energy_distribution(E) p5 = rd.continue_log(E / 1000, af.E, af.prob_NE213) return p1 * p2 * p3 * p4 * (1 - p5)
def integrand(E, theta_S, sad, forward, x_min, x_max): p1 = rd.continue_line(theta_S, sad, x_min, x_max) p2 = at.klein_nishina(E, theta_S) p3 = at.energy_limit_factor(E, theta_S, forward) * 1e35 p4 = at.energy_distribution(E) #print(p1*p2*p3*p4,p1,p2,p3,p4,E,theta_S) return p1 * p2 * p3 * p4
def plot_E_all(): scale1 = 1.7 x_min = 0 x_max = 6000 d = rd.read_h5py_file() d = rd.cut_selection(d, 9, 0, True) E = rd.extract_parameter(d, 1) # + rd.extract_parameter(d, 3) n, bins, patches = plt.hist(E, 500) x = np.linspace(x_min, x_max, 200) y = np.array([at.energy_distribution(i) for i in x]) y = y * np.amax(n) / np.amax(y) * scale1 #plt.plot(x,y,label="A") plt.xlim(x_min, x_max) plt.xlabel("Detected Energy [keV]") plt.ylabel("Frequency [Counts/Bin]")
def plot_E_dist( forward, num_bins=300, ): x_min = 0000 x_max = 5000 y_min = 0 #y_max=140000 scale1 = 1.8 scale2 = 1 d = rd.read_h5py_file() d = rd.cut_selection(d, 9, 0, forward) E = rd.extract_parameter(d, 1) + rd.extract_parameter(d, 3) n, bins, patches = plt.hist(E, num_bins) x = np.linspace(x_min, x_max, 100) y = np.array([at.energy_distribution(i) for i in x]) y = y * np.amax(n) / np.amax(y) * scale1 plt.plot(x, y, label="A") if forward: t_min, t_max, sad = at.fsad_min, at.fsad_max, at.fsad else: t_min, t_max, sad = at.bsad_min, at.bsad_max, at.bsad y2 = np.array([ quad(integrand1, t_min, t_max, (i, forward, t_min, t_max, sad), 0, 10e-5, 10e-5)[0] for i in x ]) y2 = y2 * np.amax(n) / np.amax(y2) * scale2 plt.plot(x, y2, label="B") plt.xlabel("Total Detected Energy [keV]") plt.ylabel("Frequency [Counts/Bin]") plt.legend() plt.xlim(x_min, x_max) plt.ylim(0, 50000)
def integrand2(Energy): return at.energy_distribution(Energy * 1000)
def integrand1(Energy): return at.energy_distribution(Energy * 1000) * rd.continue_linear_set( Energy, E, average_distance)
def integrand1(theta, E, forward, x_min, x_max, sad): p1 = at.klein_nishina(E, theta) * 10e30 p2 = rd.continue_line(theta, sad, x_min, x_max) p3 = at.energy_limit_factor(E, theta, forward) p4 = at.energy_distribution(E) return p1 * p2 * p3 * p4