Beispiel #1
0
    def plot_fsigma8_MG(self, zlist, fsigma8_datafile, a_B, a_M, a_trans, r):
        """
        Plot fsigma8 vs. z, rel. dev. from LCDM vs. z,
        and compute chi-squared from measurements
        for Modified Gravity.
        """
        # Get measured fsigma8 data
        __, meas_zlist, meas_fsigma8, meas_fsigma8_error = self.get_fsigma8_data(fsigma8_datafile)
        
        # LCDM fsigma8
        lcdm_fsigma8 = Peturbations().fsigma8_GR(zlist)

        # MG fsigma8 for our redshift range
        mg_fsigma8 = Peturbations().fsigma8_MG(zlist, a_B, a_M, a_trans, r)
        
        # MG fsigma8 for measured redshift range
        mg_fsigma8_meas_z = Peturbations().fsigma8_MG(meas_zlist, a_B, a_M, a_trans, r)
        
        # Compute chi squared
        mg_chisqr = self.chisqr(mg_fsigma8_meas_z, meas_fsigma8, meas_fsigma8_error)

        # Plot fsigma8
        self.ax[0].plot(zlist, mg_fsigma8, 
                        label=r'$\hat{{\alpha}}_\mathrm{{B}}={}, \hat{{\alpha}}_\mathrm{{M}}={}, a_t=1/(1+{}), r={}$'.format(
                         a_B, a_M, (1./a_trans)-1., r), 
                        zorder=1) 
        # Plot rel. dev.
        self.ax[1].plot(zlist, self.reldev(lcdm_fsigma8, mg_fsigma8), 
                        label=r'$\chi^2={}$'.format(mg_chisqr), 
                        zorder=1)
        """
Beispiel #2
0
    def plot_fsigma8_GR(self, zlist, fsigma8_datafile):
        """
        Plot fsigma8 vs. z, rel. dev. from LCDM vs. z,
        and compute chi-squared from measurements
        for General Relativity.
        """
        # Get measured fsigma8 data
        __, meas_zlist, meas_fsigma8, meas_fsigma8_error = self.get_fsigma8_data(fsigma8_datafile)

        # fsigma8 for our redshift range
        lcdm_fsigma8 = Peturbations().fsigma8_GR(zlist)

        # fsigma8 for measured redshift range
        lcdm_fsigma8_meas_z = Peturbations().fsigma8_GR(meas_zlist)

        # Compute chi squared
        lcdm_chisqr = self.chisqr(lcdm_fsigma8_meas_z, meas_fsigma8, meas_fsigma8_error)

        # Plot fsigma8
        self.ax[0].plot(zlist, lcdm_fsigma8, 
                        dashes=[6,4], color='black', 
                        label=r'$\Lambda\mathrm{CDM}$', 
                        zorder=2)
        # Plot rel. dev.
        self.ax[1].plot(zlist, self.reldev(lcdm_fsigma8, lcdm_fsigma8), 
                        dashes=[6,4], color='black', 
                        label=r'$\chi^2={}$'.format(lcdm_chisqr), 
                        zorder=2)
        """
Beispiel #3
0
    def plot_fsigma8_MG(self, zlist, fsigma8_datafile, a_B, a_M, a_trans, r):
        """
        Plot fsigma8 vs. z, rel. dev. from LCDM vs. z,
        and compute chi-squared from measurements
        for Modified Gravity.
        """
        # Get measured fsigma8 data
        __, meas_zlist, meas_fsigma8, meas_fsigma8_error = self.get_fsigma8_data(
            fsigma8_datafile)

        # LCDM fsigma8
        lcdm_fsigma8 = Peturbations().fsigma8_GR(zlist)

        # MG fsigma8 for our redshift range
        mg_fsigma8 = Peturbations().fsigma8_MG(zlist, a_B, a_M, a_trans, r)

        # MG fsigma8 for measured redshift range
        mg_fsigma8_meas_z = Peturbations().fsigma8_MG(meas_zlist, a_B, a_M,
                                                      a_trans, r)

        # Compute chi squared
        mg_chisqr = self.chisqr(mg_fsigma8_meas_z, meas_fsigma8,
                                meas_fsigma8_error)

        # Plot fsigma8
        self.ax[0].plot(
            zlist,
            mg_fsigma8,
            label=
            r'$\hat{{\alpha}}_\mathrm{{B}}={}, \hat{{\alpha}}_\mathrm{{M}}={}, a_t=1/(1+{}), r={}$'
            .format(a_B, a_M, (1. / a_trans) - 1., r),
            zorder=1)
        # Plot rel. dev.
        self.ax[1].plot(zlist,
                        self.reldev(lcdm_fsigma8, mg_fsigma8),
                        label=r'$\chi^2={}$'.format(mg_chisqr),
                        zorder=1)

        # Save fsigma8 output to .dat file
        output = np.vstack((zlist, mg_fsigma8)).T
        np.savetxt('fsigma8_output/fsigma8_MG_a_B_' + str(a_B) + '_a_M_' +
                   str(a_M) + '_a_trans_' + str(a_trans) + '_r_' + str(r) +
                   '.dat',
                   output,
                   delimiter='    ',
                   fmt='%0.4f',
                   header=str('Redshift z, fsigma8(z)'))
Beispiel #4
0
    def plot_fsigma8_GR(self, zlist, fsigma8_datafile):
        """
        Plot fsigma8 vs. z, rel. dev. from LCDM vs. z,
        and compute chi-squared from measurements
        for General Relativity.
        """
        # Get measured fsigma8 data
        __, meas_zlist, meas_fsigma8, meas_fsigma8_error = self.get_fsigma8_data(
            fsigma8_datafile)

        # fsigma8 for our redshift range
        lcdm_fsigma8 = Peturbations().fsigma8_GR(zlist)

        # fsigma8 for measured redshift range
        lcdm_fsigma8_meas_z = Peturbations().fsigma8_GR(meas_zlist)

        # Compute chi squared
        lcdm_chisqr = self.chisqr(lcdm_fsigma8_meas_z, meas_fsigma8,
                                  meas_fsigma8_error)

        # Plot fsigma8
        self.ax[0].plot(zlist,
                        lcdm_fsigma8,
                        dashes=[6, 4],
                        color='black',
                        label=r'$\Lambda\mathrm{CDM}$',
                        zorder=2)
        # Plot rel. dev.
        self.ax[1].plot(zlist,
                        self.reldev(lcdm_fsigma8, lcdm_fsigma8),
                        dashes=[6, 4],
                        color='black',
                        label=r'$\chi^2={}$'.format(lcdm_chisqr),
                        zorder=2)

        # Save fsigma8 output to .dat file
        output = np.vstack((zlist, lcdm_fsigma8)).T
        np.savetxt('fsigma8_output/fsigma8_LCDM.dat',
                   output,
                   delimiter='    ',
                   fmt='%0.4f',
                   header=str('Redshift z, fsigma8(z)'))
    def plot_Cl_TT_GR(self, zlist, llist):
        """
        Plot C_ell^TT vs. ell for General Relativity
        """
        # C_ell^TT
        lcdm_Cl_TT = Peturbations().Cl_TT_GR(zlist, llist)

        # Plot C_ell^TT
        self.ax[0, 1].semilogx(llist, lcdm_Cl_TT, 
                             dashes=[6,4], color='black', 
                             zorder=2)
    def plot_sigma8_GR(self, zlist):
        """
        Plot sigma8 vs. z for General Relativity
        """
        # sigma8 for our redshift range
        lcdm_sigma8 = Peturbations().sigma8_GR(zlist)

        # Plot sigma8
        self.ax[1, 0].plot(zlist, lcdm_sigma8, 
                           dashes=[6,4], color='black', 
                           zorder=2)
    def plot_Cl_kappa_kappa_GR(self, zlist, llist):
        """
        Plot C_ell^kappakappa vs. ell for General Relativity
        """
        # C_ell^kappakappa
        lcdm_Cl_kap_kap = Peturbations().Cl_kappa_kappa_GR(zlist, llist)

        # Plot C_ell^kappakappa
        self.ax[1, 1].semilogx(llist, lcdm_Cl_kap_kap, 
                             dashes=[6,4], color='black', 
                             zorder=2)
    def plot_fsigma8_GR(self, zlist):
        """
        Plot fsigma8 vs. z for General Relativity
        """
        # fsigma8 for our redshift range
        lcdm_fsigma8 = Peturbations().fsigma8_GR(zlist)

        # Plot fsigma8
        self.ax[0, 0].plot(zlist, lcdm_fsigma8, 
                           dashes=[6,4], color='black', 
                           label=r'$\Lambda\mathrm{CDM}$', 
                           zorder=2)
    def plot_sigma8_MG(self, zlist, a_B, a_M, a_trans, r):
        """
        Plot sigma8 vs. z for Modified Gravity.
        """
        # LCDM sigma8
        #lcdm_sigma8 = Peturbations().sigma8_GR(zlist)

        # MG sigma8 for our redshift range
        mg_sigma8 = Peturbations().sigma8_MG(zlist, a_B, a_M, a_trans, r)

        # Plot sigma8
        self.ax[1, 0].plot(zlist, mg_sigma8, 
                           zorder=1) 
    def plot_Cl_kappa_kappa_MG(self, zlist, llist, a_B, a_M, a_trans, r):
        """
        Plot C_ell^kappakappa vs. ell for Modified Gravity
        """
        # LCDM C_ell^kappakappa
        #lcdm_Cl_kap_kap = Peturbations().Cl_kappa_kappa_GR(zlist, llist)

        # MG C_ell^kappakappa
        mg_Cl_kap_kap = Peturbations().Cl_kappa_kappa_MG(zlist, llist, a_B, a_M, a_trans, r)
        
        # Plot C_ell^kappakappa
        self.ax[1, 1].semilogx(llist, mg_Cl_kap_kap, 
                             zorder=1) 
    def plot_Cl_kappa_kappa_MG(self, llist, a_B, a_M, a_trans, r):
        """
        s
        """
        # LCDM Cl_kappa_kappa
        lcdm_Cl_kap_kap = Peturbations().Cl_kappa_kappa_GR(llist)

        # MG Cl_kappa_kappa
        mg_Cl_kap_kap = Peturbations().Cl_kappa_kappa_MG(
            llist, a_B, a_M, a_trans, r)

        # Plot Cl_kappa_kappa
        self.ax[0].loglog(
            llist,
            mg_Cl_kap_kap,
            label=
            r'$\hat{{\alpha}}_\mathrm{{B}}={}, \hat{{\alpha}}_\mathrm{{M}}={}, a_t=1/(1+{}), r={}$'
            .format(a_B, a_M, (1. / a_trans) - 1., r),
            zorder=1)
        # Plot rel. dev.
        self.ax[1].semilogx(llist,
                            self.reldev(lcdm_Cl_kap_kap, mg_Cl_kap_kap),
                            zorder=1)
    def plot_fsigma8_MG(self, zlist, a_B, a_M, a_trans, r):
        """
        Plot fsigma8 vs. z for Modified Gravity.
        """
        # LCDM fsigma8
        #lcdm_fsigma8 = Peturbations().fsigma8_GR(zlist)

        # MG fsigma8 for our redshift range
        mg_fsigma8 = Peturbations().fsigma8_MG(zlist, a_B, a_M, a_trans, r)

        # Plot fsigma8
        #self.ax[0, 0].plot(zlist, mg_fsigma8, 
        #                   label=r'$\hat{{\alpha}}_\mathrm{{B}}={}, \hat{{\alpha}}_\mathrm{{M}}={}, a_t=1/(1+{}), r={}$'.format(
        #                       a_B, a_M, (1./a_trans)-1., r), 
        #                   zorder=1) 
        self.ax[0, 0].plot(zlist, mg_fsigma8, 
                           label=r'$\hat{{\alpha}}_\mathrm{{B}}={}, \hat{{\alpha}}_\mathrm{{M}}={}$'.format(a_B, a_M), 
                           zorder=1) 
    def plot_Cl_kappa_kappa_GR(self, llist):
        """
        s
        """
        # Cl_kappa_kappa
        lcdm_Cl_kap_kap = Peturbations().Cl_kappa_kappa_GR(llist)

        # Plot Cl_kappa_kappa
        self.ax[0].loglog(llist,
                          lcdm_Cl_kap_kap,
                          dashes=[6, 4],
                          color='black',
                          label=r'$\Lambda\mathrm{CDM}$',
                          zorder=2)
        # Plot rel. dev.
        self.ax[1].semilogx(llist,
                            self.reldev(lcdm_Cl_kap_kap, lcdm_Cl_kap_kap),
                            dashes=[6, 4],
                            color='black',
                            zorder=2)
Beispiel #14
0
import numpy as np
from scipy.optimize import curve_fit

from peturbations import Peturbations

peturb = Peturbations()
"""
Current observational measurements on fsigma8 

We read in current measurements between redshifts 0 and 2
from fsigma8_measurements.dat
Column format: Index_number, z, fs8, fs8_error
"""
data = np.loadtxt('fsigma8_measurements.dat')
meas_fsigma8 = data[:, 2]
meas_fsigma8_error = data[:, 3]
meas_zlist = data[:, 1]
"""
popt, pcov = curve_fit(peturb.fsigma8_MG_fit, meas_zlist, meas_fsigma8, 
                       #p0=[0.1, 1./(1.+7.), 4.],
                       sigma=1./(meas_fsigma8_error*meas_fsigma8_error), 
                       bounds=([0., 1./(1.+10.), 1.5], [0.15, 1./(1.+0.), 4.]))
#perr = np.sqrt(np.diag(pcov))
"""
"""
# Varying alpha_b only. 
# We set alpha_m = 0.1, a_trans = 1./(1.+7.), and r = 4.
# Finds a_B = 0.00130177 which has chisqr = 3.45158072065
# This works -- it has a smaller chisqr than 0.00130176 and 0.00130178
popt, pcov = curve_fit(peturb.fsigma8_MG_fit, meas_zlist, meas_fsigma8, 
                       p0=[0.],