Пример #1
0
def elbert_pmodels(slice_val=1.,
                   kind='conv nu_mu',
                   hadr='DPMJET-III-3.0.6',
                   prpl='ice_allm97_step_1',
                   corr_only=False):
    pmodels = [(pm.HillasGaisser2012, 'H3a', 'H3a'),
               (pm.PolyGonato, False, 'poly-gonato'),
               (pm.GaisserHonda, None, 'GH')]
    echoice = exthp.corr if corr_only else exthp.passrates
    label = extlabel(corr_only) + ' {} {}'.format(tex(kind), tex(slice_val))
    if slice_val > 1:
        cths = np.linspace(0, 1, 100)
        emu = extsv.minimum_muon_energy(extsv.overburden(cths))
        plt.plot(cths, echoice(kind)(slice_val, emu, cths), 'k--', label=label)
    else:
        ens = np.logspace(2, 9, 100)
        emu = extsv.minimum_muon_energy(extsv.overburden(slice_val))
        plt.plot(ens, echoice(kind)(ens, emu, slice_val), 'k--', label=label)
    for pmodel in pmodels:
        pr = fn(slice_val)(slice_val,
                           kind,
                           pmodel[:2],
                           hadr,
                           prpl=prpl,
                           corr_only=corr_only,
                           label='{} {} {}'.format(pmodel[2], tex(kind),
                                                   tex(slice_val)))
    plt.legend()
    plt.tight_layout(0.3)
Пример #2
0
def elbert_only(slice_val=1., kind='conv nu_mu'):
    plt.figure()
    if 'nu_e' in kind:
        echoices = [exthp.passrates]
        names = [r'$\mathcal{P}_{\rm pass}^{\rm uncor, GJKvS}$']
    else:
        echoices = [exthp.corr, exthp.passrates]
        names = [extlabel(True), extlabel(False)]
    if slice_val > 1:
        cths = np.linspace(0, 1, 100)
        emu = extsv.minimum_muon_energy(extsv.overburden(cths))
        for echoice, name in zip(echoices, names):
            plt.plot(cths,
                     echoice(kind)(slice_val, emu, cths),
                     '--',
                     label=name)
    else:
        ens = np.logspace(2, 9, 100)
        emu = extsv.minimum_muon_energy(extsv.overburden(slice_val))
        for echoice, name in zip(echoices, names):
            plt.plot(ens, echoice(kind)(ens, emu, slice_val), '--', label=name)
    plt.title(r'{}, {}'.format(tex(kind), tex(slice_val)))
    plt.ylim(0., 1.)
    plt.ylabel(r'Passing fraction')
    plt.xlim(10**3, 10**7)
    plt.xscale('log')
    plt.xlabel(r'$E_\nu$ [GeV]')
    plt.legend()
    plt.tight_layout(0.3)
Пример #3
0
def elbert(slice_val=1.,
           kind='conv nu_mu',
           pmodel=(pm.GaisserHonda, None),
           prpl='ice_allm97_step_1',
           corr_only=False):
    hadrs = ['DPMJET-III-3.0.6', 'SIBYLL2.3c']
    echoice = exthp.corr if corr_only else exthp.passrates
    if slice_val > 1:
        cths = np.linspace(0, 1, 100)
        emu = extsv.minimum_muon_energy(extsv.overburden(cths))
        plt.plot(cths,
                 echoice(kind)(slice_val, emu, cths),
                 'k--',
                 label='Analytic approx. {} {}'.format(tex(kind),
                                                       tex(slice_val)))
    else:
        ens = np.logspace(2, 9, 100)
        emu = extsv.minimum_muon_energy(extsv.overburden(slice_val))
        plt.plot(ens,
                 echoice(kind)(ens, emu, slice_val),
                 'k--',
                 label='Analytic approx. {} {}'.format(tex(kind),
                                                       tex(slice_val)))

    for hadr in hadrs:
        fn(slice_val)(slice_val,
                      kind,
                      pmodel,
                      hadr,
                      prpl=prpl,
                      corr_only=corr_only,
                      label='{} {} {}'.format(hadr, tex(kind), tex(slice_val)))
    plt.legend()
    plt.tight_layout(0.3)
Пример #4
0
def fig_extsv():
    kinds = ['conv_nue', 'pr_nue', 'conv_numu', 'pr_numu']
    cos_ths = [0.25, 0.85]
    ens = np.logspace(2, 9, 100)
    useexts = [False, True]
    labels = ['This work', 'GJKvS']
    for kind in kinds:
        plt.figure()
        plt.title(titling[kind])
        for idx, useext in enumerate(useexts):
            for cos_th in cos_ths:
                if useext:
                    emu = extsv.minimum_muon_energy(extsv.overburden(cos_th))
                    plt.plot(ens,
                             exthp.passrates(kind)(ens, emu, cos_th),
                             linestyles[idx])
                else:
                    clabel = r'$\cos \theta_z = {}$'.format(
                        cos_th) if idx == 0 else None
                    plots.fn(cos_th)(cos_th, kind, label=clabel)

            plt.axvline(np.nan,
                        color='k',
                        linestyle=linestyles[idx],
                        label=labels[idx])
            plt.gca().set_prop_cycle(None)
        plt.legend()
        plt.tight_layout(0.3)
        save('fig/extsv_{}.eps'.format(kind))
Пример #5
0
def corsika(cos_theta_bin=-1,
            kind='conv nu_mu',
            pmodel=(pm.HillasGaisser2012, 'H3a'),
            hadr='SIBYLL2.3',
            density=('CORSIKA', ('SouthPole', 'December')),
            prpl='ice_allm97_step_1',
            corsika_file='eff_maxmu',
            plot_nuveto_lines=False,
            plot_legacy_veto_lines=False):
    if isinstance(cos_theta_bin, list):
        [
            corsika(cth, kind, pmodel, hadr, density, prpl, corsika_file,
                    plot_nuveto_lines, plot_legacy_veto_lines)
            for cth in cos_theta_bin
        ]
        return

    cfile = pickle.load(open(
        resource_filename('nuVeto',
                          os.path.join('/data/corsika',
                                       corsika_file + '.pkl')), 'rb'),
                        encoding='latin1')
    fraction = 'eff' in corsika_file
    eff, elow, eup, xedges, yedges = cfile[mceq_categ_format(kind)]
    cos_theta = centers(yedges)[cos_theta_bin]
    clean = eff[:, cos_theta_bin] > 0
    xcenters = 10**centers(xedges)[clean]

    pr = plt.errorbar(xcenters,
                      eff[:, cos_theta_bin][clean],
                      xerr=np.asarray(
                          list(
                              zip(xcenters - 10**xedges[:-1][clean],
                                  10**xedges[1:][clean] - xcenters))).T,
                      yerr=np.asarray(
                          list(
                              zip(elow[:, cos_theta_bin][clean],
                                  eup[:, cos_theta_bin][clean]))).T,
                      label='CORSIKA {} {}'.format(tex(kind), tex(cos_theta)),
                      fmt='.')
    if plot_legacy_veto_lines and fraction:
        ens = np.logspace(2, 9, 100)
        emu = extsv.minimum_muon_energy(extsv.overburden(cos_theta))
        plt.plot(ens,
                 exthp.passrates(kind)(ens, emu, cos_theta),
                 'k--',
                 label='Analytic approx. {} {}'.format(tex(kind),
                                                       tex(cos_theta)))
    if plot_nuveto_lines:
        pr_enu(cos_theta,
               kind,
               pmodel=pmodel,
               hadr=hadr,
               prpl=prpl,
               density=density,
               fraction=fraction,
               label='{} {} {}'.format(hadr, tex(kind), tex(cos_theta)),
               color=pr[0].get_color())
    plt.legend()
Пример #6
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)
Пример #7
0
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)