當前位置: 首頁>>代碼示例>>Python>>正文


Python Planck13.critical_density方法代碼示例

本文整理匯總了Python中astropy.cosmology.Planck13.critical_density方法的典型用法代碼示例。如果您正苦於以下問題:Python Planck13.critical_density方法的具體用法?Python Planck13.critical_density怎麽用?Python Planck13.critical_density使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在astropy.cosmology.Planck13的用法示例。


在下文中一共展示了Planck13.critical_density方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: find_rvirial

# 需要導入模塊: from astropy.cosmology import Planck13 [as 別名]
# 或者: from astropy.cosmology.Planck13 import critical_density [as 別名]
def find_rvirial(dd, ds, center, start_rad = 0, delta_rad_coarse = 20, delta_rad_fine = 1, rad_units = 'kpc'):
    vir_check = 0
    r0 = ds.arr(start_rad, rad_units)
    critical_density = cosmo.critical_density(ds.current_redshift).value   #is in g/cm^3
    max_ndens_arr=center

    while True:
        r0_prev = r0
        r0 = r0_prev + ds.arr(delta_rad_coarse, rad_units)
        v_sphere = ds.sphere(max_ndens_arr, r0)
        dark_mass 	= v_sphere[('DarkMatter', 'Mass')].in_units('Msun').sum()	
        rho_internal = dark_mass.in_units('g')/((r0.in_units('cm'))**3.*(pi*4/3.))
        print rho_internal, r0, dark_mass
        if rho_internal < 200*ds.arr(critical_density,'g')/ds.arr(1.,'cm')**3.:
            #now run fine test
            print('\tNow running fine search on the virial radius')
            r0 = r0_prev
            while True:
                r0 += ds.arr(delta_rad_fine, rad_units)
                v_sphere = ds.sphere(max_ndens_arr, r0)
                dark_mass 	= v_sphere[('DarkMatter', 'Mass')].in_units('Msun').sum()	
                rho_internal = dark_mass.in_units('g')/((r0.in_units('cm'))**3.*(pi*4/3.))
                print rho_internal, r0
                if rho_internal < 200*ds.arr(critical_density,'g')/ds.arr(1.,'cm')**3.:
                    rvir = r0
                    print dark_mass.in_units('Msun'), rvir.in_units('kpc')
                    return rvir
開發者ID:gsnyder206,項目名稱:vela-yt-sunrise,代碼行數:29,代碼來源:findGalaxyProps.py

示例2: r200

# 需要導入模塊: from astropy.cosmology import Planck13 [as 別名]
# 或者: from astropy.cosmology.Planck13 import critical_density [as 別名]
def r200(z,M_200): ## unit: arcsec

	critical_density = Planck13.critical_density(z).si.value # unit: kg/m^3
	m2arcs = np.degrees(1.0/Planck13.angular_diameter_distance(z).si.value)*3600.
	critical_density  = critical_density*Planck13.H0/100./m2arcs**3/2e30 # unit: Msun/arcsec^3/h

	r200_cube = 200*critical_density/M_200/(4./3.*np.pi)
	r200 = r200_cube**(1./3.)

	return r200
開發者ID:jwhsueh,項目名稱:SHARP_jw,代碼行數:12,代碼來源:NFWprofile.py

示例3: __init__

# 需要導入模塊: from astropy.cosmology import Planck13 [as 別名]
# 或者: from astropy.cosmology.Planck13 import critical_density [as 別名]
    def __init__(self, redshifts, cosmology='Planck13', cm='DuttonMaccio'):
        if type(redshifts) != np.ndarray:
            redshifts = np.array(redshifts)
        if redshifts.ndim != 1:
            raise ValueError("Input redshift array must have 1 dimension.")
        if np.sum(redshifts < 0.) > 0:
            raise ValueError("Redshifts cannot be negative.")

        if cosmology == 'Planck13':
            from astropy.cosmology import Planck13 as cosmo
        elif cosmology == 'WMAP9':
            from astropy.cosmology import WMAP9 as cosmo
        elif cosmology == 'WMAP7':
            from astropy.cosmology import WMAP7 as cosmo
        elif cosmology == 'WMAP5':
            from astropy.cosmology import WMAP5 as cosmo
        else:
            raise ValueError('Input cosmology must be one of: \
                              Planck13, WMAP9, WMAP7, WMAP5.')
        self._cosmo = cosmo

        if cm == 'DuttonMaccio':
            self._cm = 'DuttonMaccio'
        elif cm == 'Prada':
            self._cm = 'Prada'
        elif cm == 'Duffy':
            self._cm = 'Duffy'
        else:
            raise ValueError('Input concentration-mass relation must be \
                              one of: DuttonMaccio, Prada, Duffy.')

        self.describe = "Ensemble of galaxy clusters and their properties."
        self.number = redshifts.shape[0]
        self._z = redshifts
        self._rho_crit = cosmo.critical_density(self._z)
        self._massrich_norm = 2.7 * (10**13) * units.Msun
        self._massrich_slope = 1.4
        self._df = pd.DataFrame(self._z, columns=['z'])
        self._Dang_l = cosmo.angular_diameter_distance(self._z)
        self._m200 = None
        self._n200 = None
        self._r200 = None
        self._rs = None
        self._c200 = None
        self._deltac = None
開發者ID:inonchiu,項目名稱:cluster-lensing,代碼行數:47,代碼來源:clusters.py

示例4: get_crit

# 需要導入模塊: from astropy.cosmology import Planck13 [as 別名]
# 或者: from astropy.cosmology.Planck13 import critical_density [as 別名]
def get_crit():
    return pl13.critical_density(0)
開發者ID:CherieDay,項目名稱:DishPapers,代碼行數:4,代碼來源:cosmology.py


注:本文中的astropy.cosmology.Planck13.critical_density方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。