astropy/astropy — pull request #201 by nhmc (2012-04-15 07:04:14+00:00)
Title: Cosmology package for possible inclusion in astropy

Here is the first iteration of a cosmology package for astropy, as discussed on the astropy-dev list:

https://groups.google.com/forum/?fromgroups#!topic/astropy-dev/lyfxR9gJVe0

There is a mechanism for setting and getting a default cosmology, and printing a warning if this default is requested without having been explicitly set. The convenience functions in cosmology.py show how other functions in astropy could both accept a Cosmology instance as a keyword argument, and access the default cosmology if that keyword is not set.

Some things it would be good to have feedback on:

- fast spline interpolations for the integration methods of the pre-defined cosmologies aren't implemented yet. I'm not sure of the best way to add these.

- the methods involving integrations only work on a scalar redshift value at the moment. They could be changed to also accept a list or array of redshifts. This is trade-off between making the code more complicated and make the methods convenient to use. I think I'm in favour of accepting redshift arrays.

- There are a lot of other variables (e.g. sigma8, spectral index) associated with the cosmologies in parameters.py that are not saved when a cosmology instance is created, since they are not currently used. However, it might be nice to have a standard way to link them to a Cosmology instance. One possibility is to simply make the parameter dictionary an attribute of the instance. Maybe @roban could comment on the best way to do this to make integration with CosmoloPy easy?

Thanks!