Пример #1
0
def main():

    # set cosmology and linear power spectrum
    H0 = 70.0
    Omega_M = 0.279000
    Omega_b = 0.046100
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.972000
    inputPk = "../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e+21

    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, 1)
    yy_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk)

    #param_ind_dict = {'eps_f':0, 'eps_DM':1, 'f_star':2, 'S_star':3, 'A_C':4, 'alpha_nt':5, 'n_nt':6, 'beta_nt':7, 'gamma_mod0':8, 'gamma_mod_zslope':9, 'x_break':10, 'x_smooth':11, 'n_nt_mod':12, 'clump0':13, 'clump_zslope':14, 'x_clump':15, 'alpha_clump1':16, 'alpha_clump2':17}

    #params = [ 'eps_f', 'f_star', 'S_star', 'A_C', 'alpha_nt', 'n_nt', 'beta_nt', 'gamma_mod0', 'gamma_mod_zslope', 'n_nt_mod', 'clump0', 'clump_zslope', 'x_clump', 'alpha_clump1', 'alpha_clump2' ]
    #params = [ 'eps_f', 'f_star', 'clump0' ]

    #params = [ 'eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt', 'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'clump_zslope', 'x_clump', 'alpha_clump1', 'alpha_clump2' ]
    params = ['eps_f', 'f_star', 'clump0']

    fish = {}
    covar = {}
    for survey in surveys:
        if 'ROSAT' in survey:
            ell = np.linspace(10, 700)
        elif 'Chandra' in survey:
            ell = np.linspace(10, 10000)

        fish[survey] = xxfisher(ell, params, survey)

        covar[survey] = np.linalg.inv(fish[survey])

        #print(covar[survey])
    '''
    for i, p in enumerate(params) :
        if p in priors.keys() :
            fish[survey] += 1.0/priors[p]**2.0
    '''
    for i1, p1 in enumerate(params):
        for i2, p2 in enumerate(params):

            f = plt.figure(figsize=(5, 5))
            ax = f.add_axes([0.20, 0.18, 0.72, 0.72])

            if i1 != i2:
                for survey in surveys:
                    cov = extract_submat(covar[survey], i1, i2)
                    ax = plot_error_ellipse(ax, cov, p1, p2, survey)
                    print(survey, p1, p2, cov)
                # recompute the ax.dataLim
                ax.relim()
                # update ax.viewLim using the new dataLim
                ax.autoscale_view()

                ax.set_xlabel(param_label_dict[p1])
                ax.set_ylabel(param_label_dict[p2])
                #ax.set_xlim(param_lim_dict[p1])
                #ax.set_ylim(param_lim_dict[p2])

                #ax.set_xlabel(param_label_dict[p1]+'/'+param_label_dict[p1]+r'$({\rm fid)}$')
                #ax.set_ylabel(param_label_dict[p2]+'/'+param_label_dict[p2]+r'$({\rm fid})$')
                ax.legend(loc='best')
                f.savefig("cov_" + p1 + "_" + p2 + ".png")

            else:
                continue
Пример #2
0
Omega_k=0.000000
n_s=0.972000
inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
nH = 2.45e21
'''
H0 = 67.32117
Omega_M = 0.3158
Omega_b = 0.0490
w0 = -1.000000
Omega_k = 0.000000
n_s = 0.96605
inputPk = "../input_pk/planck_2018_test_matterpower.dat"
nH = 0
opt = 1

xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH, inputPk,
                        opt)


def beam(ell, fwhm=13.7):

    #convert fwhm from arcmin to radian
    fwhm = math.radians(fwhm / 60.0)
    sigma = fwhm / (np.sqrt(8.0 * np.log(2.0)))
    bl = np.exp(ell * (ell + 1.0) * sigma**2)

    return bl


def lnlike(theta, x, y, invcov):
    '''
    double alpha0; // fiducial : 0.18
Пример #3
0
def main ():

    # set cosmology and linear power spectrum
    H0=70.0
    Omega_M=0.279000
    Omega_b=0.046100
    w0=-1.000000
    Omega_k=0.000000
    n_s=0.972000
    inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e+20

    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH, inputPk)

    shot_noise = 3.e-22

    ell = 10.**np.linspace(np.log10(1.),np.log10(3.e4), 1000)

    theta = [5.0,0.000000,0.026000,0.120000,1.000000,0.180000,0.800000,0.500000,0.100000,1.720000,0.195000,0.010000,0.800000,0.670000,0.730000,1.230000,0.880000,3.850000]

    param_ind_dict = {'eps_f':0, 'eps_DM':1, 'f_star':2, 'S_star':3, 'A_C':4, 'gamma_mod0':8, 'gamma_mod_zslope':9, 'clump0':13, 'clump_zslope':14}
    param_label_dict = {'eps_f':r'\epsilon_f', 'eps_DM':r'\epsilon_{DM}', 'f_star':r'f_\star', 'S_star':r'S_\star', 'A_C':r'A_C','gamma_mod0':r'\Gamma_0', 'gamma_mod_zslope':r'\beta_\Gamma', 'clump0':r'C_0', 'clump_zslope':r'\beta_C'}

    rosat_ell, rosat_cl, rosat_var = read_data("../ROSAT/rosat_R6_mask_hfi_R2_small_ell.txt")
    rosat_cl *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    rosat_cl_err = np.sqrt(rosat_var)*rosat_ell*(rosat_ell+1.)/(2.0*math.pi)

    theta_bf = [ 9.94086977e+00,  3.19781381e-02,  1.98917895e-01,  2.85712644e-03,
 -2.28851210e+01]

    theta[param_ind_dict['eps_f']] = theta_bf[0]
    theta[param_ind_dict['f_star']] = theta_bf[1]
    theta[param_ind_dict['S_star']] = theta_bf[2]
    theta[param_ind_dict['clump0']] = theta_bf[3]
    shot_noise = 10.0**theta_bf[4]

    f = plt.figure( figsize=(5,5) )
    ax = f.add_axes([0.18,0.16,0.75,0.75])

    cl = power (ell, theta)
    cl *= ell*(ell+1)/(2.0*math.pi)
    psn = np.full(ell.shape, shot_noise, dtype = np.float64)
    psn *=  ell*(ell+1)/(2.0*math.pi)
    total = cl + psn

    ax.plot (ell, total, ls = '-' )
    ax.plot (ell, cl, ls = '--')
    ax.plot (ell, psn, ls = ':')

    ax.errorbar(rosat_ell, rosat_cl, yerr = rosat_cl_err, color='k', label=r"ROSAT")

    ax.set_xlim ( 10, 3e4 )
    #ax.set_ylim ( 1e-19, 1e-13)
    ax.set_xlabel(r'$\ell$')
    ax.set_ylabel(r'$\ell(\ell+1)C_{\ell}/2\pi\,[{\rm erg^{2}s^{-2}cm^{-4}str^{-2}}]$')

    ax.set_xscale('log')
    ax.set_yscale('log')
    ax.legend(loc='best')

    outname = '../plots/bf_xxpower.pdf'
    f.savefig(outname)
    f.clf()
Пример #4
0
def main():

    # set cosmology and linear power spectrum
    H0 = 70.0
    Omega_M = 0.279000
    Omega_b = 0.046100
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.972000
    inputPk = "../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e+20
    opt = 1
    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, opt)

    shot_noise = 3.e-22

    ell = 10.**np.linspace(np.log10(10.), np.log10(3e4), 40)

    theta_fid = [
        4.0, 3.e-5, 0.026000, 0.120000, 1.000000, 0.180000, 0.800000, 0.500000,
        0.100000, 1.720000, 0.195000, 0.010000, 0.800000, 0.670000, 0.730000,
        1.230000, 0.880000, 3.85000
    ]

    param_ind_dict = {
        'eps_f': 0,
        'eps_DM': 1,
        'f_star': 2,
        'S_star': 3,
        'A_C': 4,
        'alpha_nt': 5,
        'n_nt': 6,
        'beta_nt': 7,
        'gamma_mod0': 8,
        'gamma_mod_zslope': 9,
        'x_break': 10,
        'x_smooth': 11,
        'n_nt_mod': 12,
        'clump0': 13,
        'clump_zslope': 14,
        'x_clump': 15,
        'alpha_clump1': 16,
        'alpha_clump2': 17
    }

    param_label_dict = {
        'eps_f': r'$\epsilon_f$',
        'eps_DM': r'$\epsilon_{DM}$',
        'f_star': r'$f_\star$',
        'S_star': r'$S_\star$',
        'A_C': r'$A_C$',
        'alpha_nt': r'$\alpha_{nt}$',
        'n_nt': r'$n_{nt}$',
        'beta_nt': r'$\beta_{nt}$',
        'gamma_mod0': r'$\Gamma_0$',
        'gamma_mod_zslope': r'$\beta_\Gamma$',
        'n_nt_mod': '$n_{nt,mod}$',
        'clump0': r'$C_0$',
        'clump_zslope': r'$\beta_C$',
        'x_clump': r'$x_{C}$',
        'alpha_clump1': r'$\alpha_{C1}$',
        'alpha_clump2': r'$\alpha_{C2}$'
    }

    params = [
        'eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt',
        'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'clump_zslope', 'x_clump',
        'alpha_clump1', 'alpha_clump2'
    ]
    #param_list = ['eps_f', 'f_star', 'S_star', 'clump0', 'alpha0']
    #param_list = ['f_star', 'S_star', 'clump0']
    #param_list = ['gamma_mod0']
    params = ['eps_f']

    planck_ell, planck_cl, planck_var = read_data(
        "../Planck/planck_mask_hfi_R2_small_ell.txt")
    planck_cl *= planck_ell * (planck_ell + 1.) / (2.0 * math.pi)
    planck_cl_err = np.sqrt(planck_var) * planck_ell * (planck_ell +
                                                        1.) / (2.0 * math.pi)

    for param in params:

        param_ind = param_ind_dict[param]
        param_fid = theta_fid[param_ind]
        print(param_fid)
        param_val_list = []
        color_list = ['C0', 'C1', 'C2', 'C3', 'C4']

        varlist = [0.1, 0.5, 1.0, 1.5, 2.0]
        #for i in [0.01, 0.1, 1.0, 1.67]:
        for i in [1.0]:
            #for i in varlist:
            param_val = param_fid * i
            #param_val = i
            param_val_list.append(param_val)

        f = plt.figure(figsize=(5, 5))
        ax = f.add_axes([0.18, 0.16, 0.75, 0.75])

        #ax.errorbar(planck_ell, planck_cl, yerr = planck_cl_err, color='k', label=r"Planck")
        cl_list = []
        for counter, param_val in enumerate(param_val_list):
            theta = theta_fid.copy()
            theta[param_ind] = param_val

            start = time.time()
            cl = power(ell, theta)
            end = time.time()
            print("Elapsed time: %s" % (end - start))
            cl *= ell * (ell + 1) / (2.0 * math.pi)
            cl *= (1.e6 * Tcmb)**2
            #cl *= Tcmb**2.0 * 1.e6

            label_str = param_label_dict[param] + '$= %.3f $' % (param_val)
            if param == 'eps_f':
                label_str = param_label_dict[
                    param] + r'$= %.1f \times 10^{-6}$' % (param_val)
            ax.plot(ell,
                    cl,
                    ls='-',
                    color=color_list[counter],
                    label=label_str)

        ax.set_xlim(10, 3e3)
        ax.set_xlabel(r'$\ell$')
        ax.set_ylabel(r'$10^{12}\ell(\ell+1)C_{\ell}^{yy}/2\pi$')

        ax.set_xscale('log')
        ax.set_yscale('log')
        ax.legend(loc='best')

        outname = param + '_yy_power.png'
        #outname = param+'_xx_power.png'
        f.savefig(outname)
        f.clf()
Пример #5
0
def main():

    # set cosmology and linear power spectrum
    '''
    H0=70.0
    Omega_M=0.279000
    Omega_b=0.046100
    w0=-1.000000
    Omega_k=0.000000
    n_s=0.972000
    inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e21
    opt = 1
    '''
    H0 = 67.32117
    Omega_M = 0.3158
    Omega_b = 0.0490
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.96605
    inputPk = "../input_pk/planck_2018_test_matterpower.dat"
    nH = 0.0
    opt = 1

    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, opt)

    ell = 10.**np.linspace(np.log10(10.), np.log10(1.e4), 31)

    theta_fid = [
        4.0, 3.e-5, 0.0250, 0.120000, 1.000000, 0.180000, 0.800000, 0.500000,
        0.10000, 1.720000, 0.195000, 0.010000, 0.800000, 0.2, 1.0, 6.0, 3.0
    ]

    param_ind_dict = {
        'eps_f': 0,
        'eps_DM': 1,
        'f_star': 2,
        'S_star': 3,
        'A_C': 4,
        'alpha_nt': 5,
        'n_nt': 6,
        'beta_nt': 7,
        'gamma_mod0': 8,
        'gamma_mod_zslope': 9,
        'x_break': 10,
        'x_smooth': 11,
        'n_nt_mod': 12,
        'clump0': 13,
        'alpha_clump': 14,
        'beta_clump': 15,
        'gamma_clump': 16
    }

    param_label_dict = {
        'eps_f': r'$\epsilon_f$',
        'eps_DM': r'$\epsilon_{DM}$',
        'f_star': r'$f_\star$',
        'S_star': r'$S_\star$',
        'A_C': r'$A_C$',
        'alpha_nt': r'$\alpha_{nt}$',
        'n_nt': r'$n_{nt}$',
        'beta_nt': r'$\beta_{nt}$',
        'gamma_mod0': r'$\Gamma_0$',
        'gamma_mod_zslope': r'$\beta_\Gamma$',
        'n_nt_mod': '$n_{nt,mod}$',
        'clump0': r'$C_0$',
        'alpha_clump': r'$\alpha_C$',
        'beta_clump': r'$\beta_{C}$',
        'gamma_clump': r'$\gamma_{C}$'
    }

    #rosat_ell, rosat_cl, rosat_var = read_data("../ROSAT/rosat_R4_R7_counts.txt")
    rosat_ell, rosat_cl, rosat_var = read_data(
        "../ROSAT/rosat_R4_R7_unabsorbed.txt")
    #rosat_cl *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    rosat_cl_err = np.sqrt(rosat_var)
    #rosat_cl_err *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    k_k, ell_k, beam_k, cl_k, cl_k_err = read_kolodzig()
    cl_k /= beam_k
    #cl_k *= ell_k*(ell_k+1)/(2.0*math.pi)

    #params = [ 'eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt', 'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'alpha_clump', 'beta_clump', 'gamma_clump' ]
    params = [
        'eps_f', 'f_star', 'S_star', 'clump0', 'alpha_clump', 'beta_clump',
        'gamma_clump', 'gamma_mod0'
    ]
    #params = [ 'gamma_mod0' ]
    param_values = {
        #'eps_f':[4.0 ],
        'eps_f': [2.0, 4.0, 6.0, 8.0],
        'f_star': [0.015, 0.02, 0.025, 0.03],
        'S_star': [0.06, 0.12, 0.24, 0.48],
        'clump0': [0.1, 1.0, 3.0, 10.0],
        'alpha_clump': [0.05, 1.0, 2.0, 4.0],
        'beta_clump': [0.05, 1.0, 2.0, 4.0],
        'gamma_clump': [2.0, 4.0, 8.0, 10.0],
        'gamma_mod0': [-0.1, 0.1, 1.0, 1.6667]
    }

    for param in params:

        param_ind = param_ind_dict[param]
        param_val_list = param_values[param]
        color_list = ['C0', 'C1', 'C2', 'C3']
        ls_list = [':', '-', '--', '-.']

        f = plt.figure(figsize=(4, 4))
        ax = f.add_axes([0.21, 0.16, 0.75, 0.75])

        #ax.errorbar(rosat_ell, rosat_cl, yerr = rosat_cl_err, color='k', fmt='o', label=r"ROSAT", markersize = 3)
        #ax.errorbar(ell_k, cl_k, yerr = cl_k_err, label=r'Chandra', color='r', fmt='+', markersize=3)
        cl_list = []
        for counter, param_val in enumerate(param_values[param]):
            theta = theta_fid.copy()
            theta[param_ind] = param_val

            print(theta[param_ind])
            start = time.time()
            cl = power(ell, theta)
            end = time.time()
            print("Elapsed time: %s" % (end - start))
            #cl *= ell*(ell+1)/(2.0*math.pi)

            #psn = psn*ell*(ell+1)/(2.0*math.pi)
            #cl_total *= ell*(ell+1)/(2.0*math.pi)
            #cl_list.append(cl)

            label_str = param_label_dict[param] + r'$= %.3f $' % (param_val)
            #if param == 'eps_f' :
            #    label_str = param_label_dict[param]+r'$= %.1f$'% (param_val)
            #if param == 'clump0' :
            #    label_str = param_label_dict[param]+r'$= %.1f$'% (param_val+1)
            ax.plot(ell,
                    cl,
                    ls='--',
                    color=color_list[counter],
                    label=label_str)

        ax.set_xlim(30, 1e4)
        ax.set_ylim(1e-25, 1e-19)
        ax.set_xlabel(r'$\ell$')
        #ax.set_ylabel(r'$\ell(\ell+1)C_{\ell}^{xx}/2\pi\,[{\rm cts^2 s^{-2}arcmin^{-4}}]$')
        #ax.set_ylabel(r'$C_{\ell}\,[{\rm erg^{2}s^{-2}cm^{-4}sr^{-2}}]$')
        ax.set_ylabel(r'$C_{\ell}\,[{\rm ergs^{2}s^{-2}cm^{-4}sr^{-2}}]$')

        ax.set_xscale('log')
        ax.set_yscale('log')
        ax.legend(loc='lower left', prop={'size': 10})

        #outname = '../plots/'+param+'_xx_power.pdf'
        outname = param + '_xx_power.pdf'
        f.savefig(outname)
        f.clf()
Пример #6
0
def main():

    # set cosmology and linear power spectrum
    '''
    H0=70.0
    Omega_M=0.279000
    Omega_b=0.046100
    w0=-1.000000
    Omega_k=0.000000
    n_s=0.972000
    inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e21
    opt = 1
    '''
    H0 = 67.32117
    Omega_M = 0.3158
    Omega_b = 0.0490
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.96605
    inputPk = "../input_pk/planck_2018_test_matterpower.dat"
    nH = 2.4e21
    opt = 1

    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, opt)

    shot_noise = 0.00

    #ell = 10.**np.linspace(np.log10(1.),np.log10(1.e5),40)
    ell = np.linspace(1.0, 10000.0, 10000)

    theta_fid = [
        4.0, 3.e-5, 0.026000, 0.120000, 1.000000, 0.180000, 0.800000, 0.500000,
        0.100000, 1.720000, 0.195000, 0.010000, 0.800000, 0.670000, 0.730000,
        1.230000, 0.880000, 3.85000
    ]

    param_ind_dict = {
        'eps_f': 0,
        'eps_DM': 1,
        'f_star': 2,
        'S_star': 3,
        'A_C': 4,
        'alpha_nt': 5,
        'n_nt': 6,
        'beta_nt': 7,
        'gamma_mod0': 8,
        'gamma_mod_zslope': 9,
        'x_break': 10,
        'x_smooth': 11,
        'n_nt_mod': 12,
        'clump0': 13,
        'clump_zslope': 14,
        'x_clump': 15,
        'alpha_clump1': 16,
        'alpha_clump2': 17
    }

    param_label_dict = {
        'eps_f': r'$\epsilon_f$',
        'eps_DM': r'$\epsilon_{DM}$',
        'f_star': r'$f_\star$',
        'S_star': r'$S_\star$',
        'A_C': r'$A_C$',
        'alpha_nt': r'$\alpha_{nt}$',
        'n_nt': r'$n_{nt}$',
        'beta_nt': r'$\beta_{nt}$',
        'gamma_mod0': r'$\Gamma_0$',
        'gamma_mod_zslope': r'$\beta_\Gamma$',
        'n_nt_mod': '$n_{nt,mod}$',
        'clump0': r'$C_0$',
        'clump_zslope': r'$\beta_C$',
        'x_clump': r'$x_{C}$',
        'alpha_clump1': r'$\alpha_{C1}$',
        'alpha_clump2': r'$\alpha_{C2}$'
    }
    '''
    rosat_ell, rosat_cl, rosat_var = read_data("../ROSAT/rosat_R4_R7_mask_hfi_R2_small_ell.txt")
    rosat_cl *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    rosat_cl_err = np.sqrt(rosat_var)*rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    '''
    params = [
        'eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt',
        'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'clump_zslope', 'x_clump',
        'alpha_clump1', 'alpha_clump2'
    ]

    f = plt.figure(figsize=(5, 5))
    ax = f.add_axes([0.18, 0.16, 0.75, 0.75])

    #ax.errorbar(rosat_ell, rosat_cl, yerr = rosat_cl_err, color='k', label=r"ROSAT")

    cl = power(ell, theta_fid)
    nside = 2048
    fwhm = math.radians(12. / 60.)
    recon_map = hp.sphtfunc.synfast(cl,
                                    nside,
                                    fwhm=fwhm,
                                    pixwin=True,
                                    new=True)

    cmap = hp.mollview(recon_map)
    hp.graticule()
    plt.savefig('recon_map.png')

    cl_recon = hp.sphtfunc.anafast(recon_map)
    ell_recon = (np.arange(cl_recon.size)).astype(float)
    print(ell_recon, cl_recon)
    cl *= ell * (ell + 1) / (2.0 * math.pi)
    cl_recon *= ell_recon * (ell_recon + 1) / (2.0 * math.pi)

    ax.plot(ell, cl, ls='-', label='original')
    ax.plot(ell_recon, cl_recon, ls='-', label='healpix')

    ax.set_xlim(10, 3e3)
    ax.set_ylim(1e-19, 1e-15)
    ax.set_xlabel(r'$\ell$')
    ax.set_ylabel(
        r'$\ell(\ell+1)C_{\ell}^{xx}/2\pi\,[{\rm erg^{2}s^{-2}cm^{-4}str^{-2}}]$'
    )

    ax.set_xscale('log')
    ax.set_yscale('log')
    ax.legend(loc='best')

    #outname = '../plots/'+param+'_xx_power.pdf'
    outname = 'recon_xx_power.png'
    f.savefig(outname)
    f.clf()
Пример #7
0
def main():

    # set cosmology and linear power spectrum
    '''
    H0=70.0
    Omega_M=0.279000
    Omega_b=0.046100
    w0=-1.000000
    Omega_k=0.000000
    n_s=0.972000
    inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e21
    opt = 1
    '''
    H0 = 67.32117
    Omega_M = 0.3158
    Omega_b = 0.0490
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.96605
    inputPk = "../input_pk/planck_2018_test_matterpower.dat"
    nH = 0
    opt = 1

    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, opt)

    shot_noise = 3.0e-21

    ell = 10.**np.linspace(np.log10(10.), np.log10(3.e4), 31)

    theta_best = [
        2.3932, 3.e-5, 0.0254, 0.09520, 1.000000, 0.45200, 0.841000, 1.628000,
        0.102400, 1.720000, 0.195000, 0.010000, 1.6960, 0.9227, 2.4602, 4.5937
    ]

    theta_best = np.array(theta_best, dtype='double')

    param_ind_dict = {
        'eps_f': 0,
        'eps_DM': 1,
        'f_star': 2,
        'S_star': 3,
        'A_C': 4,
        'A_nt': 5,
        'B_nt': 6,
        'gamma_nt': 7,
        'gamma_mod0': 8,
        'gamma_mod_zslope': 9,
        'x_break': 10,
        'x_smooth': 11,
        'clump0': 12,
        'alpha_clump': 13,
        'beta_clump': 14,
        'gamma_clump': 15
    }

    param_label_dict = {
        'eps_f': r'$\epsilon_f/10^{-6}$',
        'eps_DM': r'$\epsilon_{DM}$',
        'f_star': r'$f_\star$',
        'S_star': r'$S_\star$',
        'A_C': r'$A_C$',
        'A_nt': r'$A_{nt}$',
        'B_nt': r'$B_{nt}$',
        'gamma_nt': r'$\gamma_{nt}$',
        'gamma_mod0': r'$\Gamma_0$',
        'gamma_mod_zslope': r'$\beta_\Gamma$',
        'n_nt_mod': '$n_{nt,mod}$',
        'clump0': r'$C_0$',
        'clump_zslope': r'$\beta_C$',
        'x_clump': r'$x_{C}$',
        'alpha_clump1': r'$\alpha_{C1}$',
        'alpha_clump2': r'$\alpha_{C2}$'
    }

    rosat_ell, rosat_cl, rosat_var = read_data(
        "../ROSAT/rosat_R4_R7_chandra_unabsorbed.txt")
    #rosat_cl *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    rosat_cl_err = np.sqrt(rosat_var)
    #k_k, ell_k, beam_k, cl_k, cl_k_err = read_kolodzig ()
    #cl_k /= beam_k
    #cl_k *= ell_k*(ell_k+1)/(2.0*math.pi)

    #params = [ 'eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt', 'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'clump_zslope', 'x_clump', 'alpha_clump1', 'alpha_clump2' ]

    f = plt.figure(figsize=(4, 4))
    ax = f.add_axes([0.21, 0.16, 0.75, 0.75])

    ax.errorbar(rosat_ell,
                rosat_cl,
                yerr=rosat_cl_err,
                color='k',
                fmt='o',
                label=r"ROSAT")
    #ax.errorbar(ell_k, cl_k, yerr = cl_k_err, label=r'Kolodzig+18')
    start = time.time()
    cl = power(ell, theta_best)
    #cl_up = power (ell, theta_cup)
    #cl_dn = power (ell, theta_cdn)
    end = time.time()
    print("Elapsed time: %s" % (end - start))
    with open('best_fit.txt', 'w') as outf:
        print('# ell C_ell [ergs^2/s^2/cm^4/sr^2]', file=outf)
        for i in np.arange(len(ell)):
            print(ell[i], cl[i], file=outf)

    #cl *= ell*(ell+1)/(2.0*math.pi)
    ax.plot(ell, cl, ls='-', label='best fit model')
    ax.set_xlim(100, 3e4)
    #ax.set_ylim ( 1e-19, 1e-14)
    ax.set_xlabel(r'$\ell$')
    ax.set_ylabel(r'$C_{\ell}^{xx},[{\rm erg^{2}s^{-2}cm^{-4}sr^{-2}}]$')
    #ax.set_ylabel(r'$\ell(\ell+1)C_{\ell}^{xx}/2\pi\,[{\rm cts^{2}s^{-2}arcmin^{-2}}]$')
    ax.set_xscale('log')
    ax.set_yscale('log')
    ax.legend(loc='upper left')

    #outname = '../plots/'+param+'_xx_power.pdf'
    outname = 'bf_xx_power.png'
    f.savefig(outname)
    f.clf()
Пример #8
0
def main():

    # set cosmology and linear power spectrum
    H0 = 70.0
    Omega_M = 0.279000
    Omega_b = 0.046100
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.972000
    inputPk = "../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 0
    opt = 1
    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, opt)

    shot_noise = 0.00

    ell = 10.**np.linspace(np.log10(10.), np.log10(3.e4), 31)

    theta_fid = [
        4.0, 3.e-5, 0.0250, 0.120000, 1.000000, 0.180000, 0.800000, 0.500000,
        0.10000, 1.720000, 0.195000, 0.010000, 0.800000, 0.2, 1.0, 6.0, 3.0
    ]

    param_ind_dict = {
        'eps_f': 0,
        'eps_DM': 1,
        'f_star': 2,
        'S_star': 3,
        'A_C': 4,
        'alpha_nt': 5,
        'n_nt': 6,
        'beta_nt': 7,
        'gamma_mod0': 8,
        'gamma_mod_zslope': 9,
        'x_break': 10,
        'x_smooth': 11,
        'n_nt_mod': 12,
        'clump0': 13,
        'alpha_clump': 14,
        'beta_clump': 15,
        'gamma_clump': 16
    }

    param_label_dict = {
        'eps_f': r'$\epsilon_f$',
        'eps_DM': r'$\epsilon_{DM}$',
        'f_star': r'$f_\star$',
        'S_star': r'$S_\star$',
        'A_C': r'$A_C$',
        'alpha_nt': r'$\alpha_{nt}$',
        'n_nt': r'$n_{nt}$',
        'beta_nt': r'$\beta_{nt}$',
        'gamma_mod0': r'$\Gamma_0$',
        'gamma_mod_zslope': r'$\beta_\Gamma$',
        'n_nt_mod': '$n_{nt,mod}$',
        'clump0': r'$C_0$',
        'alpha_clump': r'$\alpha_C$',
        'beta_clump': r'$\beta_{C}$',
        'gamma_clump': r'$\gamma_{C}$'
    }

    #rosat_ell, rosat_cl, rosat_var = read_data("../ROSAT/rosat_R4_R7_mask_hfi_R2_small_ell.txt")
    #rosat_cl *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    #rosat_cl_err = np.sqrt(rosat_var)*rosat_ell*(rosat_ell+1.)/(2.0*math.pi)

    #params = ['eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt', 'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'clump_zslope', 'x_clump', 'alpha_clump1', 'alpha_clump2' ]
    params = ['gamma_mod0']
    param_values = {
        'eps_f': [1.0, 2.0, 4.0, 6.0, 8.0],
        'f_star': [0.01, 0.015, 0.02, 0.025, 0.03],
        'S_star': [0.03, 0.06, 0.12, 0.24, 0.48],
        'clump0': [0.1, 1.0, 3.0, 10.0, 30.0],
        'alpha_clump': [0.02, 0.05, 1.0, 2.0, 4.0],
        'beta_clump': [0.02, 0.05, 1.0, 2.0, 4.0],
        'gamma_clump': [1.0, 2.0, 4.0, 8.0, 10.0],
        #'gamma_mod0':[0.0, 0.1, 1.0, 1.2, 1.667]
        'gamma_mod0': [0.001, 0.01, 0.1, 0.3, 1.0]
    }

    mvir = 3.e13
    #mvir = 10.**np.linspace(13.0, 15.8, 25)
    z = 0.01

    #obs_list = ['mgas', 'lx', 'tx', 'ysz']
    profile_list = ['density']
    profile_label = {
        'pressure': r'$P(r/R_{500})\,{\rm [keV cm^-3]}$',
        'density': r'$\rho_{\rm gas}/\rho_{\rm crit}$'
    }

    x = 10**np.linspace(-3., 0.5, 100)
    mgas, m500 = mgas_m([mvir], z, theta_fid)
    for param in params:
        pro = {}
        f = {}
        ax = {}

        for o in profile_list:
            f[o] = plt.figure(figsize=(5, 5))
            ax[o] = f[o].add_axes([0.18, 0.16, 0.75, 0.75])

        param_ind = param_ind_dict[param]
        param_fid = theta_fid[param_ind]
        param_val_list = []
        color_list = ['C0', 'C1', 'C2', 'C3', 'C4']

        for i in [0.1, 0.5, 1.0, 1.5, 2.0]:
            #for i in [1.0]:
            param_val = param_fid * i
            param_val_list.append(param_val)

        cl_list = []

        for counter, param_val in enumerate(param_values[param]):
            theta = theta_fid.copy()
            theta[param_ind] = param_val

            #pro['pressure'] = pressure_profile(x, mvir, z, theta)
            pro['density'] = density_profile(x, mvir, z, theta)

            #print(x, pro['density'])

            label_str = param_label_dict[param] + r'$= %.3f $' % (param_val)
            if param == 'eps_f':
                label_str = param_label_dict[
                    param] + r'$= %.1f \times 10^{-6}$' % (param_val)
            for o in profile_list:
                ax[o].plot(x, pro[o], label=label_str)

        arnaud_pro = P_gnfw(x, m500, z, *mod_param['A10'])
        robs, rho_obs, rho_obs_err = read_observed_density()
        ax['density'].errorbar(robs,
                               rho_obs,
                               yerr=rho_obs_err,
                               color='k',
                               label='M17')
        #ax['pressure'].plot(x, arnaud_pro, color='k', label=r'Arnaud+10')

        for o in profile_list:
            ax[o].set_xlabel(r'$r/R_{500c}$')
            ax[o].set_ylabel(profile_label[o])
            ax[o].legend(loc='lower left')

            ax[o].set_xscale('log')
            ax[o].set_yscale('log')

            outname = param + '_' + o + '_profile.png'
            f[o].savefig(outname)
            f[o].clf()
Пример #9
0
def power_model (x, params) :

    # set cosmology and linear power spectrum
    H0=70.000000
    Omega_M=0.279000
    Omega_b=0.046100
    w0=-1.000000
    Omega_k=0.000000
    n_s=0.972000
    nH = 1.e22
    inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH, inputPk)

    '''
    double alpha0; // fiducial : 0.18
    double n_nt;   // fiducial : 0.80
    double beta;   // fiducial : 0.50
    double eps_f;  // fiducial : 3.97e-6
    double eps_DM; // fiducial : 0.00
    double f_star; // fiducial : 0.026
    double S_star; // fiducial : 0.12
    double A_C;    // fiducial : 1.00
    double gamma_mod0; // fiducial : 0.10
    double gamma_mod_zslope; // fiducial : 1.72
    double x_break; // fiducial : 0.195
    double x_smooth; // fiducial : 0.01
    double n_nt_mod; // fiducial : 0.80
    '''
    #alpha0, n_nt, beta, eps_f, eps_DM, f_star, S_star, A_C, gamma_mod0, gamma_mod_zslope, x_break, x_smooth, n_nt_mod = theta
    #xx_power.set_Flender_params(alpha0, n_nt, beta, eps_f*1e-6, eps_DM, f_star, S_star, A_C, gamma_mod0, gamma_mod_zslope, x_break, x_smooth, n_nt_mod)

    #eps_f, f_star, S_star, gamma_mod0, gamma_mod_zslope, clump0, clump_zslope = theta
    eps_f, f_star, S_star, clump0, noise = params[0], params[1], params[2], params[3], param[4]

    #fix DM profile
    eps_DM = 0.006
    A_C = 1.0

    #fix non-thermal pressure term
    alpha0 = 0.18
    n_nt = 0.80
    beta = 0.50
    x_smooth = 0.01
    n_nt_mod = 0.80
    x_break = 0.195

    gamma_mod0 = 0.10
    gamma_mod_zslope = 1.72

    #clumping terms
    #clump0 = 0.0
    clump_zslope = 0.0
    x_clump = 1.23
    alpha_clump1 = 0.88
    alpha_clump2 = 3.85

    xx_power.set_Flender_params(alpha0, n_nt, beta, eps_f*1e-6, eps_DM, f_star, S_star, A_C, gamma_mod0, gamma_mod_zslope, x_break, x_smooth, n_nt_mod, clump0, clump_zslope, x_clump, alpha_clump1, alpha_clump2, noise)

    model = xx_power.return_xx_power(x) # [erg cm^-2 s^-1 str^-1]^2

    return model
Пример #10
0
def main():

    # set cosmology and linear power spectrum
    '''
    H0=70.0
    Omega_M=0.279000
    Omega_b=0.046100
    w0=-1.000000
    Omega_k=0.000000
    n_s=0.972000
    inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e21
    opt = 1
    '''
    H0 = 67.32117
    Omega_M = 0.3158
    Omega_b = 0.0490
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.96605
    inputPk = "../input_pk/planck_2018_test_matterpower.dat"
    nH = 2.4e21
    opt = 1

    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, opt)

    shot_noise = 0.00

    ell = 10.**np.linspace(np.log10(10.), np.log10(3.e4), 31)

    theta_fid = [
        4.0, 3.e-5, 0.0800, 0.120000, 1.000000, 0.180000, 0.800000, 0.500000,
        0.10000, 1.720000, 0.195000, 0.010000, 0.800000, 0.9, 1.0, 6.0, 3.0
    ]

    param_ind_dict = {
        'eps_f': 0,
        'eps_DM': 1,
        'f_star': 2,
        'S_star': 3,
        'A_C': 4,
        'alpha_nt': 5,
        'n_nt': 6,
        'beta_nt': 7,
        'gamma_mod0': 8,
        'gamma_mod_zslope': 9,
        'x_break': 10,
        'x_smooth': 11,
        'n_nt_mod': 12,
        'clump0': 13,
        'clump_zslope': 14,
        'x_clump': 15,
        'alpha_clump1': 16,
    }

    param_label_dict = {
        'eps_f': r'$\epsilon_f/10^{-6}$',
        'eps_DM': r'$\epsilon_{DM}$',
        'f_star': r'$f_\star$',
        'S_star': r'$S_\star$',
        'A_C': r'$A_C$',
        'alpha_nt': r'$\alpha_{nt}$',
        'n_nt': r'$n_{nt}$',
        'beta_nt': r'$\beta_{nt}$',
        'gamma_mod0': r'$\Gamma_0$',
        'gamma_mod_zslope': r'$\beta_\Gamma$',
        'n_nt_mod': '$n_{nt,mod}$',
        'clump0': r'$C_0$',
        'clump_zslope': r'$\beta_C$',
        'x_clump': r'$x_{C}$',
        'alpha_clump1': r'$\alpha_{C1}$',
        'alpha_clump2': r'$\alpha_{C2}$'
    }

    #rosat_ell, rosat_cl, rosat_var = read_data("../ROSAT/rosat_R4_R7_mask_hfi_R2_small_ell.txt")
    #rosat_cl *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    #rosat_cl_err = np.sqrt(rosat_var)*rosat_ell*(rosat_ell+1.)/(2.0*math.pi)

    #params = ['eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt', 'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'clump_zslope', 'x_clump', 'alpha_clump1', 'alpha_clump2' ]
    params = ['eps_f', 'f_star', 'clump0']

    redshift, dlz = np.linspace(-4, np.log10(3.0), 10, retstep=True)

    redshift = 10**redshift

    print(dlz)

    my_cosmo = cosmo.Cosmology()
    hubble = my_cosmo.cosmo.h
    print(hubble)

    mvir, dlm = np.linspace(13, 16, 20, retstep=True)
    flux, dlf = np.linspace(-20, -10, 20, retstep=True)

    mvir = 10**mvir
    flux = 10**flux

    Nsperster = np.zeros(flux.shape)

    redo = False

    if redo:
        for iv, f in enumerate(flux):
            for iz, z in enumerate(redshift):
                dVdz = my_cosmo.cosmo.differential_comoving_volume(
                    z).value * hubble**3
                s = []
                for mass in mvir:
                    ff, m500 = xray_flux(mass, z, theta_fid)
                    s.append(ff)
                s = np.array(s)
                mlim = np.interp(f, s, mvir)

                #h = hmf.MassFunction(z=z, Mmin=13, Mmax=16, dlog10m=0.1)
                h = hmf.MassFunction(z=z)

                Nm = 0.0
                for im, mass in enumerate(h.m):
                    if mass >= mlim:
                        Nm += h.dlog10m * h.dndlog10m[im] * dVdz * z * dlz
                Nsperster[iv] += Nm

        np.save("logNlogS.npy", Nsperster)

    surveys = ["CDFS", "COSMOS", "XXL", "S82", "RASS"]
    areas = [0.25, 2.0, 50.0, 31.0, 4.0 * 3.141592 * ster2sqdeg * 0.25]
    sens = [0.66e-15, 1.7e-15, 5e-15, 0.87e-15, 5.6e-13]

    fig = plt.figure(figsize=(4, 4))
    ax = fig.add_axes([0.21, 0.16, 0.75, 0.75])

    print(areas, sens)
    ax.scatter(areas, sens, s=1.0, marker='o')

    for i, txt in enumerate(surveys):
        ax.annotate(txt, (areas[i], sens[i]))

    ax.set_xlabel(r'Area [deg$^2$]')
    ax.set_ylabel(r'flux [erg/s/cm$^2$]')

    ax.set_xscale('log')
    ax.set_yscale('log')
    #ax.set_xlim(1e-2, 1e5 )
    #ax.set_ylim(1e-16, 1e-12)

    #ax.legend(loc='best')

    plt.show()

    fig.savefig("wedding_test.png")
    fig.clf()
Пример #11
0
def main():

    # set cosmology and linear power spectrum
    '''
    H0=70.0
    Omega_M=0.279000
    Omega_b=0.046100
    w0=-1.000000
    Omega_k=0.000000
    n_s=0.972000
    inputPk="../input_pk/wmap9_fid_matterpower_z0.dat"
    nH = 2.4e21
    opt = 1
    '''
    H0 = 67.32117
    Omega_M = 0.3158
    Omega_b = 0.0490
    w0 = -1.000000
    Omega_k = 0.000000
    n_s = 0.96605
    inputPk = "../input_pk/planck_2018_test_matterpower.dat"
    nH = 2.4e21
    opt = 1

    xx_power.init_cosmology(H0, Omega_M, Omega_b, w0, Omega_k, n_s, nH,
                            inputPk, opt)

    shot_noise = 0.00

    ell = 10.**np.linspace(np.log10(10.), np.log10(3.e4), 31)

    theta_fid = [
        4.0, 3.e-5, 0.0500, 0.120000, 1.000000, 0.180000, 0.800000, 0.500000,
        0.10000, 1.720000, 0.195000, 0.010000, 0.800000, 0.9, 1.0, 6.0, 3.0
    ]

    param_ind_dict = {
        'eps_f': 0,
        'eps_DM': 1,
        'f_star': 2,
        'S_star': 3,
        'A_C': 4,
        'alpha_nt': 5,
        'n_nt': 6,
        'beta_nt': 7,
        'gamma_mod0': 8,
        'gamma_mod_zslope': 9,
        'x_break': 10,
        'x_smooth': 11,
        'n_nt_mod': 12,
        'clump0': 13,
        'clump_zslope': 14,
        'x_clump': 15,
        'alpha_clump1': 16,
        'alpha_clump2': 17
    }

    param_label_dict = {
        'eps_f': r'$\epsilon_f/10^{-6}$',
        'eps_DM': r'$\epsilon_{DM}$',
        'f_star': r'$f_\star$',
        'S_star': r'$S_\star$',
        'A_C': r'$A_C$',
        'alpha_nt': r'$\alpha_{nt}$',
        'n_nt': r'$n_{nt}$',
        'beta_nt': r'$\beta_{nt}$',
        'gamma_mod0': r'$\Gamma_0$',
        'gamma_mod_zslope': r'$\beta_\Gamma$',
        'n_nt_mod': '$n_{nt,mod}$',
        'clump0': r'$C_0$',
        'clump_zslope': r'$\beta_C$',
        'x_clump': r'$x_{C}$',
        'alpha_clump1': r'$\alpha_{C1}$',
        'alpha_clump2': r'$\alpha_{C2}$'
    }

    #rosat_ell, rosat_cl, rosat_var = read_data("../ROSAT/rosat_R4_R7_mask_hfi_R2_small_ell.txt")
    #rosat_cl *= rosat_ell*(rosat_ell+1.)/(2.0*math.pi)
    #rosat_cl_err = np.sqrt(rosat_var)*rosat_ell*(rosat_ell+1.)/(2.0*math.pi)

    #params = ['eps_f', 'f_star', 'S_star', 'alpha_nt', 'n_nt', 'beta_nt', 'gamma_mod0', 'gamma_mod_zslope', 'clump0', 'clump_zslope', 'x_clump', 'alpha_clump1', 'alpha_clump2' ]
    params = ['eps_f', 'f_star', 'clump0']

    mvir = 10.**np.linspace(14.0, 15.5, 20)
    z = 1e-4

    #obs_list = ['mgas', 'lx', 'tx']
    obs_list = ['lx']
    #obs_list = ['mgas']
    obs_label = {
        #'lx': r'$L_X(0.15<r/R_{500}<1,z=0)\,{\rm [10^{44}ergs/s]}$',
        'lx': r'$L_X(0.5-2.0\,{\rm keV})\,{\rm [10^{44}ergs/s]}$',
        'mgas': r'$M_{\rm gas} (<R_{500}) {[M_\odot]}$',
        'tx': r'$T_X(0.15<r/R_{500}<1,z=0)\,{\rm [keV]}$',
        'ysz': r'$Y_{SZ}(<R_{500},z=0)\,{\rm [Mpc^2] }$'
    }

    for param in params:
        obs = {}
        f = {}
        ax = {}

        for o in obs_list:
            f[o] = plt.figure(figsize=(4, 4))
            ax[o] = f[o].add_axes([0.21, 0.16, 0.75, 0.75])

        param_ind = param_ind_dict[param]
        param_fid = theta_fid[param_ind]
        param_val_list = []
        color_list = ['C0', 'C1', 'C2', 'C3', 'C4']

        #multi_list =  [1.0]
        multi_list = [0.5, 1.0, 2.0]
        #multi_list =  [0.1,0.3,1.0,3.0,10.0]
        if param == 'f_star':
            #multi_list =  [1.0]
            multi_list = [0.5, 1.0, 2.0]
        for i in multi_list:

            param_val = param_fid * i
            param_val_list.append(param_val)

        cl_list = []
        for counter, param_val in enumerate(param_val_list):
            print(param, param_val)
            theta = theta_fid.copy()
            theta[param_ind] = param_val
            obs['lx'], m500 = lx_m(mvir, z, theta)
            obs['tx'], m500 = tx_m(mvir, z, theta)
            obs['mgas'], m500 = mgas_m(mvir, z, theta)
            #obs['ysz'],m500 = ysz_m(mvir, z, theta)

            label_str = param_label_dict[param] + r'$= %.3f $' % (param_val)
            if param == 'eps_f':
                label_str = param_label_dict[param] + r'$= %.1f$' % (param_val)
            if param == 'clump0':
                label_str = param_label_dict[param] + r'$= %.1f$' % (
                    param_val + 1)

            #label_str = r'model'
            for o in obs_list:
                ax[o].plot(m500, obs[o], label=label_str)

        lx_arnaud = arnaud_lx_m(m500)
        lx_mantz = mantz_lx_m(m500, z)
        ysz_arnaud = arnaud_ysz_m(m500)
        #ax['lx'].plot(m500, lx_arnaud, color='r', label=r'Arnaud+10')
        ax['lx'].plot(m500, lx_mantz, color='b', label=r'Mantz+16')
        #ax['ysz'].plot(m500, ysz_arnaud, color='k', label=r'Arnaud+10')

        for o in obs_list:
            ax[o].set_xlabel(r'$M_{500c}$ [$M_\odot]$')
            ax[o].set_ylabel(obs_label[o])
            ax[o].legend(loc='best')

            ax[o].set_xscale('log')
            ax[o].set_yscale('log')

            outname = param + '_' + o + '_m_z0.png'
            f[o].savefig(outname)
            f[o].clf()