roban/CosmoloPy — pull request #3 by berianjames (2012-03-27 02:40:37+00:00)
Title: extra perturbation module functionailty, extra parameter set, small addition to distance module

Well, this is my first pull request so I have no idea what to write. I'm also not sure if I should requesting the pull into master; the branch works, but my code might be messy. I guess that's what the fork + pull model is for.

I'll send an email with a bit more discussion of motivation so that I can keep the change discussion restricted to code. Here is what I have added:

Added baryonic features to transfer function

I have wrapped the second (chronologically, first?) Eisenstein & Hu code, which computes the transfer function with baryonic effects, though for a more restricted set of LCDM cosmologies. This wrapping has been done in the same way as EH.power, but with some modifications to the tf_fit.c source code to avoid pointers in function calls. All of the new files in the branch are the result of this addition.

I have tried (and I think succeeded) in making everything backward compatible, but it required some gymnastics, which can perhaps be improved. I have created a 'baryonic_effects' key in the cosmology dictionary, which defaults to False. It is set in extras. When it is False, cosmolopy behaves as before, returning a tuple (TF_cb, TF_cdn) from the EH.power call. When it is True, cosmolopy returns a tuple (TF with baryonic effects, TF without baryonic effects) from EH.tf_fit and EH.power. If 'baryonic_effects' is not present in the dictionary, cosmolopy.perturbation throws an exception, which is not ideal, but is currently the case for the 'N_nu' key as well, and is resolved in the same way (i.e., with extras).

I have updated the EH/README to describe what I've changed and added a test script test_tf_fit.py. The perturbation module has been altered to work with this new keyword (for instance, it is included in the list of keywords that get unwrapped in calls to sigma_r.)

Added spectral moment computation to perturbation module

Spectral moments are \sigma_j(R,z) = \int_0^\infty k^{2(j+1)}P(k) dk, so that \sigma_0(R,z) = \sigma_r(R,z). The moments are used in perturbation theory calculations. However, while \sigma_r is conventionally smoothed with a tophat, the sigma_j are computed with a gaussian filter (w_gauss). So I have essentially created a parallel set of functions that repeat the sigma_r routine and internal routines. This is wasteful, and perhaps there is a better way, for instance by passing 'tophat' or 'gauss' as a keyword, and then aliasing sigma_r to sigma_j(R,0,z,**C).

Additions to cosmolopy.parameters and cosmolopy.distance

I have included (constant, but non-unity) w as a cosmological parameter, in extras. This affects cosmological distance calculations and the comoving and angular distance routines have been updated to use this information when w is present in the dictionary.

I have also added a function to generate a fiducial WiggleZ cosmological parameter set. These aren't WiggleZ results, but a reference cosmology, so I can see that it may not be generally useful. But this is quite a common task (retrieving a fiducial, but possibly non WMAP cosmology), so perhaps the right thing is to have a way to let a user save a parameter set without modifying the python source. That has only just occurred to me, so I have no further elaboration on it now.

Okay! I think that's all!