コード例 #1
0
ファイル: test_core.py プロジェクト: mcrnogor/nuXgal
def test_CrossCorrelation():
    ns_astro = NeutrinoSample()
    ns_astro.inputData(astropath)

    gs = GALAXY_LIBRARY.get_sample('analy')
    w_cross = ns_astro.getCrossCorrelation(gs.overdensityalm)

    if MAKE_TEST_PLOTS:
        figs = FigureDict()
        color = [
            'r', 'orange', 'limegreen', 'skyblue', 'mediumslateblue', 'purple',
            'grey'
        ]

        o_dict = figs.setup_figure('Wcross',
                                   xlabel="l",
                                   ylabel=r'$w$',
                                   figsize=(6, 8))
        axes = o_dict['axes']
        for i in range(Defaults.NEbin):
            axes.plot(Defaults.ell,
                      gs.analyCL[0:3 * Defaults.NSIDE] * 10**(i * 2),
                      color='k',
                      lw=2)
            w_cross[i] *= 10**(i * 2)

        figs.plot_cl('Wcross',
                     Defaults.ell,
                     np.abs(w_cross),
                     xlabel="l",
                     ylabel=r'$C_{l}$',
                     colors=color,
                     ymin=1e-7,
                     ymax=1e10,
                     lw=3)

        figs.save_all(testfigpath, 'pdf')
コード例 #2
0
ファイル: test_core.py プロジェクト: mcrnogor/nuXgal
def atmBG_coszenith(energyBin=0):

    eg = EventGenerator()
    N_coszenith = eg.atm_gen.coszenith()[energyBin]
    recovered_values = eg.atmBG_coszenith(int(np.sum(N_coszenith[:, 1])),
                                          energyBin)

    index = np.where(np.abs(recovered_values) > 1)
    if len(index) > 1:
        print(index, recovered_values[index])

    if MAKE_TEST_PLOTS:
        figs = FigureDict()
        figkey = 'N_coszenith' + str(energyBin)
        o_dict = figs.setup_figure(figkey,
                                   xlabel=r'$\cos\,\theta$',
                                   ylabel='Number of counts',
                                   figsize=(8, 6))
        fig = o_dict['fig']
        axes = o_dict['axes']
        axes.plot(N_coszenith[:, 0], N_coszenith[:, 1], lw=2, label='data')
        axes.hist(recovered_values, N_coszenith[:, 0], label='mock')
        fig.legend()
        figs.save_all(testfigpath, 'pdf')