[AstroPy] astropy.cosmology

Juande Santander Vela jdsant at iaa.es
Thu Dec 5 12:06:44 EST 2013


Hi, Enrique,

I don’t find the age function in astropy.cosmology, but the loopback_time, but I think the answer stands.

If you want to obtain the inverse function, assuming loopback_time is continuous, and it should, you can use scipy.optimize methods to find out the redshift. For instance, the redshift corresponding to a 0.2Gyears lookback time, you can do:

 from  scipy.optimize import newton
 import astropy.cosmology as cosmo

 newton(lambda x: cosmo.lookback_time(x).value-0.2, 0)

or, in general:

 from  scipy.optimize import newton
 import astropy.cosmology as cosmo

 def redshift_from_lookback_time(gyears):
    return newton(lambda x: cosmo.lookback_time(x).value-gyears, 0)

Hope that helps.

El 05/12/2013, a las 11:01, ES.Enrique Perez <eperez at iaa.es> escribió:

> Geetings.
> 
> I may have overlooked the answer in the docs, but really haven't been able to find it:
> 
> astropy.cosmology age(some_redshift) provides the age corresponding to a given redshfit,
> but what is the reverse function that provides the redshift corresponding to a given age?
> 
> Thanks,
> Enrique
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy

--
Juande Santander Vela
VIA-SKA Project Manager
Instituto de Astrofísica de Andalucía (IAA-CSIC)
Glorieta de la Astronomía s/n, E-18008, Granada, Spain

Henry Ford: La mayoría de la gente gasta más tiempo y energías en intentar esquivar los problemas que en tratar de resolverlos.




More information about the AstroPy mailing list