How to use the pyccl.Cosmology function in pyccl

To help you get started, we’ve selected a few pyccl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LSSTDESC / CLMM / clmm / modbackend / ccl.py View on Github external
def set_cosmo_params_dict (self, cosmo_dict):
        h = 0.67
        Omega_c = 0.27
        Omega_b = 0.045
        
        if 'H0' in cosmo_dict:
            h = cosmo_dict['H0'] / 100.0
        if 'Omega_b' in cosmo_dict:
            Omega_b = cosmo_dict['Omega_b']
        if 'Omega_c' in cosmo_dict:
            Omega_c = cosmo_dict['Omega_c']
        
        self.cosmo = ccl.Cosmology (Omega_c = Omega_c, Omega_b = Omega_b, h = h, sigma8 = 0.8, n_s = 0.96, T_CMB = 0.0, Neff = 0.0,
                                    transfer_function='bbks', matter_power_spectrum='linear')
github LSSTDESC / CLMM / examples / demo_polaraveraging.py View on Github external
from astropy import units as u
import pickle
import polaraveraging
import clmm

cosmo_object_type = "astropy"
try:
    import pyccl
except:
    cosmo_object_type = "astropy"
if cosmo_object_type == "astropy":
    from astropy.cosmology import FlatLambdaCDM
    cosmo = FlatLambdaCDM(70., Om0 = 0.3) # astropy cosmology setting, will be replaced by ccl
elif cosmo_object_type == "ccl":
    import pyccl as ccl
    cosmo = ccl.Cosmology(Omega_c=0.25, Omega_b = 0.05,h = 0.7,n_s = 0.97, sigma8 = 0.8, Omega_k = 0.)

cl = clmm.load_cluster('9687686568.p')

ra_l = cl.ra
dec_l = cl.dec
z = cl.z

e1 = cl.galcat['e1']
e2 = cl.galcat['e2']

ra_s = cl.galcat['ra']
dec_s = cl.galcat['dec'] 

theta, g_t , g_x = polaraveraging._compute_shear(ra_l, dec_l, ra_s, dec_s, e1, e2, sky = "flat")  #calculate distance and tangential shear and cross shear for each source galaxy
#theta, g_t , g_x = compute_shear(ra_l, dec_l, ra_s, dec_s, e1, e2, sky = "curved") #curved sky
rMpc = polaraveraging._theta_units_conversion(theta,"Mpc",z,cosmo,cosmo_object_type=cosmo_object_type)