Exemplo n.º 1
0
def makeSkyMap(samples, lmax, nside=16, psrs=None, cmap='YlOrBr'):

    # number of pixels total
    npix = hp.nside2npix(nside)

    # initialize theta and phi map coordinantes
    skypos=[]
    for ii in range(npix):
        skypos.append(np.array(hp.pix2ang(nside,ii)))

    skypos = np.array(skypos)
    harmvals = PALutils.SetupSkymapPlottingGrid(lmax,skypos)

    pwr = []
    for ii in range(len(samples)):
        samples_tot = np.append(2.*np.sqrt(np.pi), samples[ii])
        gwp = PALutils.GWpower(samples_tot, harmvals)
        pwr.append(gwp)

    pwr = np.array(pwr)
    pwr = np.mean(pwr, axis=0)

    ax = plt.subplot(111, projection='astro mollweide')
    ax.grid()
    plot.outline_text(ax)
    plot.healpix_heatmap(pwr, cmap=cmap)
    plt.colorbar(orientation='horizontal')

    # add pulsars locations
    if np.all(psrs):
        ax.plot(psrs[:,0], psrs[:,1], '*', color='w', markersize=6, mew=1, mec='w')

    return pwr