本文整理汇总了Python中astropy.cosmology.FlatLambdaCDM.comoving_volume方法的典型用法代码示例。如果您正苦于以下问题:Python FlatLambdaCDM.comoving_volume方法的具体用法?Python FlatLambdaCDM.comoving_volume怎么用?Python FlatLambdaCDM.comoving_volume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astropy.cosmology.FlatLambdaCDM
的用法示例。
在下文中一共展示了FlatLambdaCDM.comoving_volume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FlatLambdaCDM
# 需要导入模块: from astropy.cosmology import FlatLambdaCDM [as 别名]
# 或者: from astropy.cosmology.FlatLambdaCDM import comoving_volume [as 别名]
Create a custom cosmology object
>>> from astropy.cosmology import FlatLambdaCDM
>>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3)
>>> cosmo
FlatLambdaCDM(H0=70, Om0=0.3, Ode0=0.7)
Compute the comoving volume to z=6.5 in cubic Mpc using
this cosmology
>>> cosmo.comoving_volume(6.5)
2521696198211.6924
Compute the age of the universe in Gyr using the
pre-defined WMAP 5-year and WMAP 9-year cosmologies
>>> from astropy.cosmology import WMAP5, WMAP9
>>> WMAP5.age(0)
13.723782349795023
>>> WMAP9.age(0)
13.768899510689097
Create a cosmology with a varying `w'
>>> from astropy.cosmology import Flatw0waCDM
>>> cosmo = Flatw0waCDM(H0=70, Om0=0.3, w0=-1, wa=0.2)
Find the separation in proper kpc at z=4 corresponding to
10 arcsec in this cosmology compared to a WMAP9 cosmology
>>> cosmo.kpc_proper_per_arcmin(4) * 10 / 60.
68.87214405278925
>>> WMAP9.kpc_proper_per_arcmin(4) * 10 / 60.
71.21374615575363
示例2: Remap_Ranges
# 需要导入模块: from astropy.cosmology import FlatLambdaCDM [as 别名]
# 或者: from astropy.cosmology.FlatLambdaCDM import comoving_volume [as 别名]
print zoom_grid.shape, peak_Zoom.shape, red_Zoom.shape, x1_Zoom.shape
return zoom_grid, peak_Zoom, red_Zoom, x1_Zoom
#m=query_db()
#make_grid(m)
eff_grid, ebin=Load_Grid('Supernova_Efficiency_Grid.npy', 'Bin_Edges.npy')
zoom_grid, peak_Zoom, red_Zoom, x1_Zoom=Reg_Grid(eff_grid, ebin, 1)
def Remap_Ranges(care, rang):
return (care-min(rang))*(len(rang))/((max(rang)-min(rang)))
def Interp_On_Zoom(peak, red, x1, zoom_grid=zoom_grid, peak_Zoom=peak_Zoom, red_Zoom=red_Zoom, x1_Zoom=x1_Zoom):
effs=ndimage.map_coordinates(zoom_grid,[[Remap_Ranges(peak, peak_Zoom)],[Remap_Ranges(red, red_Zoom)],[Remap_Ranges(x1, x1_Zoom)]],order=1)
return effs
z=0.12
print 'Redshift:', z
print 'Volume:', cosmo.comoving_volume(z)
def Get_Supernovae(z):
cur.execute("SELECT distinct(sncosmo_fits.ptfname), sncosmo_fits.ra, sncosmo_fits.dec, sncosmo_fits.redshift, sncosmo_fits.t0, sncosmo_fits.x1 from sncosmo_fits join ptfname on sncosmo_fits.ptfname=ptfname.ptfname join subtraction on ptfname.sub_id=subtraction.id join ptffield on ptffield.id=subtraction.ptffield where sncosmo_fits.ra>310. and sncosmo_fits.ra<360. and sncosmo_fits.dec>-7. and sncosmo_fits.dec<20. and sncosmo_fits.redshift<%s and sncosmo_fits.c>-0.3 and sncosmo_fits.c<0.4 and sncosmo_fits.x1<3. and sncosmo_fits.x1>-3. and ptffield.color_excess<0.1 and sncosmo_fits.pass_cut=True;",(float(z),))
#cur.execute("SELECT distinct(sncosmo_fits.ptfname), sncosmo_fits.ra, sncosmo_fits.dec, sncosmo_fits.redshift, sncosmo_fits.t0, sncosmo_fits.x1 from sncosmo_fits join ptfname on sncosmo_fits.ptfname=ptfname.ptfname join subtraction on ptfname.sub_id=subtraction.id join ptffield on ptffield.id=subtraction.ptffield where sncosmo_fits.ra>107. and sncosmo_fits.ra<270 and sncosmo_fits.dec>-2. and sncosmo_fits.dec<85. and sncosmo_fits.redshift<%s and ptffield.color_excess<0.1 ;",(float(z),))
print 'Database Query Complete'
m=cur.fetchall()
cur.close()
m=np.array(m)
print 'Number of Object:', len(m[:,0])
return m
m=Get_Supernovae(z)
'''
m[:,0] ptfname