plt.yscale("log")
    plt.legend(loc="best")
    plt.savefig("plots/powerspectrum_WMAPtype.png")
    print "dataset generated"

else:
    dlm =np.load("Dataset_planck2015_900SNR1_13arcmin.npy")
    #dlm =np.load("Dataset_planck2015_175eminus4_whitenoise_7arcmin.npy")
    #dlm =np.load("Dataset_planck2015__175eminus4_7arcmin_128_200.npy")
    print "dataset read %s"%"Dataset_planck2015_900SNR1_13arcmin.npy"


Cl = cb.generate_spectrum(dd)
nl = Cl[900,1]*bl[900]**2*np.ones(2500)

dlm = CG.filter_alm(dlm,lmax)
#################################################
dlm[[hp.Alm.getidx(lmax,0,0),hp.Alm.getidx(lmax,1,0),hp.Alm.getidx(lmax,1,1)]]=0
nl = nl[:lmax+1]
bl=bl[:lmax+1]


print nl[5]
    


# Could be used for asymetric proposal, but now only for first guess
x_mean = np.array([0.02222,0.1197,0.078,3.089,0.9655,67.31])
#np.load("mean_from_posteriors_highres.npy")#np.array([0.02222,0.1197,0.078,3.089,0.9655,67.31])                            

#cov_mat from tableTT_lowEB downloaded from PLA, used in proposal

# Gaussian beam fwhm 5 arcmin 
#bl = CG.gaussian_beam(2500,5)
#bl = CG.gaussian_beam(2500,5*np.sqrt(hp.nside2pixarea(nside,degrees=True))*60)
bl = CG.gaussian_beam(2500,15)

# Spectrum according to parameter defined above
if generate_new_data==1:
    Cl = cb.generate_spectrum(dd)
    lmax_temp = Cl.shape[0]-1
    alm = hp.synalm(Cl[:,1])
    dlm = hp.almxfl(alm,bl[:lmax_temp+1])
    nlm = hp.synalm(nl[:lmax_temp+1])
    dlm = dlm+nlm
    dlm_filt = CG.filter_alm(dlm,lmax+1)
    print "dataset generated"

else:
    dlm =np.load("Dataset_planck2015_35009eminus4_whitenoise.npy")
    print "dataset read"
#################################################


# Could be used for asymetric proposal, but now only for first guess
x_mean = np.array([0.02222,0.1197,0.078,3.089,0.9655,67.31])


#cov_mat from tableTT_lowEB downloaded from PLA, used in proposal
cov_new = np.load("cov_tableTT_lowEB_2_3_5_6_7_23.npy")