[AstroPy] astropy.cosmology

Erik Tollerud erik.tollerud at gmail.com
Wed Dec 11 11:41:12 EST 2013


> I don’t see much point in implementing reverse functions of -everything- —
> it’s hard to imagine scenarios where most of them would be interesting.
> When will somebody want to know what redshift corresponds to a given
> luminosity distance?   Age is really the only one I can imagine having
> wide interest, so I would just start with that in the interest of avoiding
> bloat.

Suppose you have a galaxy where you think you know what its absolute
magnitude should be (say its a standard candle) and have an apparent
magnitude, and you want to use it to know what redshift it's at.  Then
you need this, because the distance modulus is tied to the luminosity
distance (this example came to mind because I've actually needed this
for actual science in the past).  My point here is mainly that just
because we don't want all of them, doesn't mean some other users don't
have a need.

That said, I see your point in that others are probably generally less
useful (e.g. AD distance), and duplicating every function/method does
make everything harder to deal with. Perhaps the solution is to add an
`inverse` function to `astropy.cosmology`?  You could then do
something like ``z = cosmology.inverse(WMAP.age, 1 * u.Gyr)``.  That
would keep the API cleaner, and it would be fairly trivial to
implement it that way using the method Juande and Alex are talking
about.  Then if we decide to optimize some of them later, we can add
those in and have the `inverse` function use those if they are
present.





>
> Alex
>



-- 
Erik



More information about the AstroPy mailing list