[AstroPy] Redshift vs. Luminosity Distance

Nicholas Ross npross at roe.ac.uk
Mon Jul 22 19:54:58 EDT 2019


Hi, 

Been struggling with this one::

	import astropy.units as u
	from astropy.cosmology import FlatLambdaCDM
	from astropy.cosmology import z_at_value

	cosmo = FlatLambdaCDM(H0=67.7, Om0=0.307)  
	luminosity_distances = np.array([0.0, 500., 1000., 2000., 3000., 5000., 6000.]) * u.Mpc
	z_at_value(cosmo.luminosity_distance, luminosity_distances)
	 
	---------------------------------------------------------------------------
	ValueError                                Traceback (most recent call last)
	<ipython-input-5-0294161797b4> in <module>()
	      5 cosmo = FlatLambdaCDM(H0=67.7, Om0=0.307)  #Banados thesis
	      6 luminosity_distances = np.array([0.0, 500., 1000., 2000., 3000., 5000., 6000.]) * u.Mpc
	----> 7 z_at_value(cosmo.luminosity_distance, luminosity_distances)
	~/anaconda3/lib/python3.6/site-packages/astropy/cosmology/funcs.py in z_at_value(func, fval, zmin, zmax, ztol, maxfun)
	    116     fval_zmin = func(zmin)
	    117     fval_zmax = func(zmax)
	--> 118     if np.sign(fval - fval_zmin) != np.sign(fval_zmax - fval):
	    119         warnings.warn("""\
	    120 fval is not bracketed by func(zmin) and func(zmax). This means either…


Is this because astropy.cosmology returns the luminosity distance — which is monotonic with 
redshift in a flat/open cosmology, as 
	dL = dA*(1+z)^2 
where dA is the non-monotonic angular diameter distance??

Thanks, 
Nic




More information about the AstroPy mailing list