plt.xticks(fontsize=sz - 5) plt.yticks(fontsize=sz - 5) plt.subplots_adjust(bottom=.11) sp_r = fig_r.add_subplot(1, 1, 1) plt.figure(fig1.number) plt.subplots_adjust(right=0.99, left=.07) test_obj = sey_mod energy = np.linspace(0., E_ts, num=int(1e3)) energy_e = np.linspace(0., E_e, num=int(2e2)) energy_r = np.linspace(0., E_r, num=int(1e3)) for i_ct, ct in enumerate(cos_theta_test): thiscol = ms.colorprog(i_ct, len(cos_theta_test)) label = 'costheta=%.2f' % ct sp1.plot(E_impact_eV_test, del_true_mat[i_ct, :], color=thiscol, label=label, linewidth=linewid) sp_ts.plot(E_impact_eV_test, del_true_mat[i_ct, :], color=thiscol, label=label, linewidth=linewid) sp2.plot(E_impact_eV_test, del_elast_mat[i_ct, :], color=thiscol, label=label,
sp1 = plt.subplot(3,1,2, sharex=sp0) # plot simulation data for coast_ctr, coast_str in enumerate(coast_strs): for sey_ctr, sey in enumerate(sey_vect): #print beam_snapshot, device_name, sey try: dip_contribution_per_meter, ob, t_bun = get_simulation_ob('ArcDipReal', sey, coast_str) sim_loss_per_hc = dip_contribution_per_meter * l_dip + quad_contribution_per_meter * l_quad + drift_contribution_per_meter * l_drift if sey_ctr == 0: label = coast_str + ' e9 coasting' else: label = None color_curr = ms.colorprog(sey_ctr, N_sims) sp1.semilogy(ob.t/25e-9, ob.Nel_timep, color=color_curr, label=label, ls=coast_linestyle_dict[coast_str]) if coast_ctr == 0: label = sey else: label = None sp2 = plt.subplot(3,1,3, sharex=sp1) ms.sciy() sp2.plot(t_bun[:-1]/25e-9, sim_loss_per_hc, '.-', color=color_curr, label=label, ls=coast_linestyle_dict[coast_str]) except IOError as err: print('Got:', err)
ene_hilleret = hilleret_energy(energy) popt, pcov = curve_fit(average_true_sec_energy_PDF, energy, ene_hilleret, bounds=(1., 30.)) print('Fitted parameters for average true energy PDF:') print('p_n:') print((popt[0:10])) print('eps_n:') print((1.634185 / (popt[0:10] - 1))) plt.figure(2, figsize=(20, 15), facecolor='white') E_0s = np.array([10., 20., 35., 50., 75., 100., 300., 500.]) for i_E, E_0_curr in enumerate(E_0s): thiscol = ms.colorprog(i_E, len(E_0s)) energy = np.linspace(0.00001, E_0_curr, num=int(1e3)) sey_mod_FP, impact_management_object, _ = make_it_easier(*popt) delta_e, _, delta_ts = sey_mod_FP.yield_fun_furman_pivi(E=E_0_curr, costheta=1.) delta_ts_prime = delta_ts / (1 - delta_e) pdf = average_true_sec_energy_PDF(energy, *popt) plt.plot(energy, pdf, color=thiscol, linestyle='--', linewidth=linewid, label='FP, $E_0 =$ %.0f' % E_0_curr)
by / len_, len_, pivot='middle') bar = plt.colorbar(outp) bar.set_ticks([]) lim = 1.2 * np.max(xx_raw) sp.set_xlim(-lim, lim) sp.set_ylim(-lim, lim) mask = np.abs(y_mpB) < 1e-12 mask2 = np.abs(x_mpB) < 1e-12 if angle_ctr == 0: color = ms.colorprog(order, 4) xx_plot = np.linspace(-1, 1, 1e3) sp2.plot(x_mpB[mask], by[mask], '.', label=title, color=color) sp2.plot(xx_plot, xx_plot**order, color=color) sp3.plot(y_mpB[mask2], bx[mask2], '.', label=title, color=color) if order % 2 == 0: sp3.plot(xx_plot, np.zeros_like(xx_plot), color=color) else: sp3.plot(xx_plot, (xx_plot)**order * (-1)**((order - 1) / 2), color=color) sp2.set_ylim(-1.1, 1.1) sp3.set_ylim(-1.1, 1.1) #sp3.legend(loc='upper left', bbox_to_anchor=(1,1)) sp3.legend(loc='upper right', framealpha=0.5)
alpha = 0.9 extract_ene_hist = impact_management_object.extract_energy_distributions(n_rep, E_impact_eV_test, cos_theta_test, mass=me, Nbin_extract_ene=500, factor_ene_dist_max=1.0) plt.close('all') ms.mystyle_arial() fig1 = plt.figure(1, figsize=(3 * 8, 2 * 8)) fig1.set_facecolor('w') sp1 = fig1.add_subplot(2, 2, 1) sp2 = fig1.add_subplot(2, 2, 2) sp3 = fig1.add_subplot(2, 2, 3) sp4 = fig1.add_subplot(2, 2, 4) for i_ct, ct in enumerate(cos_theta_test): thiscol = ms.colorprog(i_ct, len(cos_theta_test)) label = 'costheta=%.2f' % ct areats = scipy.integrate.simps(extract_ene_hist['true'][:, i_ct], extract_ene_hist['emit_ene_g_hist']) areae = scipy.integrate.simps(extract_ene_hist['elast'][:, i_ct], extract_ene_hist['emit_ene_g_hist']) arear = scipy.integrate.simps(extract_ene_hist['rediff'][:, i_ct], extract_ene_hist['emit_ene_g_hist']) areaab = scipy.integrate.simps(extract_ene_hist['absorb'][:, i_ct], extract_ene_hist['emit_ene_g_hist']) sp1.plot(extract_ene_hist['emit_ene_g_hist'], extract_ene_hist['true'][:, i_ct] / areats, color=thiscol, label=label, alpha=alpha, linewidth=linewid, marker='o') sp2.plot(extract_ene_hist['emit_ene_g_hist'], extract_ene_hist['elast'][:, i_ct] / areae, color=thiscol, label=label, alpha=alpha, linewidth=linewid, marker='o') sp3.plot(extract_ene_hist['emit_ene_g_hist'], extract_ene_hist['rediff'][:, i_ct] / arear, color=thiscol, label=label, alpha=alpha, linewidth=linewid, marker='o') sp4.plot(extract_ene_hist['emit_ene_g_hist'], extract_ene_hist['absorb'][:, i_ct] / areaab, color=thiscol, label=label, alpha=alpha, linewidth=linewid, marker='o') linewid = 3 sp2.plot(0, 0, 'k', label='FP-model PDF', linewidth=linewid) # sp2.plot(0, 0, 'k', label='ECLOUD-model PDF', linewidth=linewid, linestyle='--')