def pr_cth(enu=1e5, kind='conv nu_mu', pmodel=(pm.HillasGaisser2012, 'H3a'), hadr='SIBYLL2.3c', barr_mods=(), depth=1950 * Units.m, density=('CORSIKA', ('SouthPole', 'December')), accuracy=3.5, fraction=True, prpl='ice_allm97_step_1', corr_only=False, **kwargs): """ plot the passing rate (flux or fraction) """ cths = np.linspace(0, 1, 21) passed = [ passing(enu, cos_theta, kind, pmodel, hadr, barr_mods, depth, density, accuracy, fraction, prpl, corr_only) for cos_theta in cths ] if fraction: prs = plt.plot(cths, passed, **kwargs) plt.ylim(0., 1.) plt.ylabel(r'Passing fraction') else: prs = plt.plot(cths, np.asarray(passed) * enu**3, **kwargs) plt.yscale('log') plt.ylabel(r'$E_\nu^3 \Phi_\nu [GeV^2 cm^-2 s^-1 st^-1]$') plt.xlim(0, 1) plt.xscale('linear') plt.xlabel(r'$\cos \theta$') return prs[0]
def test_elbert(cth): ens = np.logspace(2,8.9,50) mine = np.asarray( [passing(en, cth, kind='conv nu_mu', hadr='DPMJET-III-3.0.6', pmodel=(pm.GaisserHonda, None), prpl=None, corr_only=True) for en in ens]) emu = extsv.minimum_muon_energy(extsv.overburden(cth)) theirs = exthp.corr('conv nu_mu')(ens, emu, cth) print('test_elbert', cth) assert np.all(np.abs(theirs-mine)<0.022)
def test_elbert(): ens = np.logspace(2, 9, 50) cths = [0.1, 0.3, 0.8] for cth in cths: mine = np.asarray([ passing(en, cth, kind='conv_numu', hadr='DPMJET-III', pmodel=(pm.GaisserHonda, None), prpl=None, corr_only=True) for en in ens ]) emu = extsv.minimum_muon_energy(extsv.overburden(cth)) theirs = exthp.corr('conv_numu')(ens, emu, cth) assert np.all(np.abs(theirs - mine) < 0.02)
def PlotNuMuPromptPassingFraction(cos_theta, pmodel=(pm.HillasGaisser2012, 'H3a'), hadr='SIBYLL2.3c', prpl='step_1'): """ plot passing fraction for the conventional component """ enu_grid = np.logspace(3, 10, 20) enu_grid_fine = np.logspace(3, 10, 1000) pnm = [nv.passing(enu, cos_theta, kind='pr_numu') for enu in enu_grid] pnmfn = interpolate.interp1d(enu_grid, pnm, kind='cubic', assume_sorted=True, fill_value=(1, np.nan)) plt.semilogx(enu_grid_fine, pnmfn(enu_grid_fine), label='interpolated') plt.xlabel(r'$E_\nu$') plt.ylabel(r'Prompt Muon Neutrino Passing Fraction') plt.legend() plt.savefig("PromptNuMuPassingFraction.eps", dpi=300)
def pr_enu(cos_theta=1., kind='conv nu_mu', pmodel=(pm.HillasGaisser2012, 'H3a'), hadr='SIBYLL2.3c', barr_mods=(), depth=1950 * Units.m, density=('CORSIKA', ('SouthPole', 'December')), accuracy=3.5, fraction=True, prpl='ice_allm97_step_1', corr_only=False, **kwargs): """ plot the passing rate (flux or fraction) """ ens = np.logspace(3, 7, 100) if corr_only else np.logspace(3, 7, 39) passed = [ passing(en, cos_theta, kind, pmodel, hadr, barr_mods, depth, density, accuracy, fraction, prpl, corr_only) for en in ens ] if fraction: passed_fn = interpolate.interp1d(ens, passed, kind='quadratic') else: passed_fn = lambda es: 10**interpolate.interp1d( ens, np.log10(passed), kind='quadratic')(es) ens_plot = np.logspace(3, 7, 100) if fraction: prs = plt.plot(ens_plot, passed_fn(ens_plot), **kwargs) plt.ylim(0., 1.) plt.ylabel(r'Passing fraction') else: prs = plt.plot(ens_plot, passed_fn(ens_plot) * ens_plot**3, **kwargs) plt.yscale('log') plt.ylabel(r'$E_\nu^3 \Phi_\nu [GeV^2 cm^{-2} s^{-1} st^{-1}]$') plt.xlim(10**3, 10**7) plt.xscale('log') plt.xlabel(r'$E_\nu$ [GeV]') return prs[0]