sncosmo.zdist¶
- sncosmo.zdist(zmin, zmax, time=365.25, area=1.0, ratefunc=<function <lambda>>, cosmo=FlatLambdaCDM(H0=70.0 km / (Mpc s), Om0=0.3, Tcmb0=0.0 K, Neff=3.04, m_nu=None, Ob0=None))[source]¶
Generate a distribution of redshifts.
Generates the correct redshift distribution and number of SNe, given the input volumetric SN rate, the cosmology, and the observed area and time.
- Parameters:
- zmin, zmaxfloat
Minimum and maximum redshift.
- timefloat, optional
Time in days (default is 1 year).
- areafloat, optional
Area in square degrees (default is 1 square degree).
time
andarea
are only used to determine the total number of SNe to generate.- ratefunccallable
A callable that accepts a single float (redshift) and returns the comoving volumetric rate at each redshift in units of yr^-1 Mpc^-3. The default is a function that returns
1.e-4
.- cosmo
Cosmology
, optional Cosmology used to determine volume. The default is a FlatLambdaCDM cosmology with
Om0=0.3
,H0=70.0
.
Examples
Loop over the generator:
>>> for z in zdist(0.0, 0.25): ... print(z) ... 0.151285827576 0.204078030595 0.201009196731 0.181635472172 0.17896188781 0.226561237264 0.192747368762
This tells us that in one observer-frame year, over 1 square degree, 7 SNe occured at redshifts below 0.35 (given the default volumetric SN rate of 10^-4 SNe yr^-1 Mpc^-3). The exact number is drawn from a Poisson distribution.
Generate the full list of redshifts immediately:
>>> zlist = list(zdist(0., 0.25))
Define a custom volumetric rate:
>>> def snrate(z): ... return 0.5e-4 * (1. + z) ... >>> zlist = list(zdist(0., 0.25, ratefunc=snrate))