Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifications to class_interface.c #19

Open
amoradinejad opened this issue May 12, 2022 · 4 comments
Open

modifications to class_interface.c #19

amoradinejad opened this issue May 12, 2022 · 4 comments

Comments

@amoradinejad
Copy link

amoradinejad commented May 12, 2022

Hi @joezuntz

I noticed that you now replaced the old version of class_v2.7 with the latest version of class_v3.2. That's really great, I had to do it myself, but it's very nice that it is consistently replaced.

I have a few suggestions and a question about some modifications to class interface that may be helpful for some users, as I needed them myself.

  1. Add the calculation of the matter transfer function for a given (k,z) to class_interface.py. To do this, one needs to make the following modifications:
  • in boltzmann/class/class_v3.2.0/python/classy.pyxd add the definition of the new function of perturbations.c module in class_v3.2, perturbations_sources_at_k_and_z(), which calculates transfer function for a choice of (k,z)
  • in boltzmann/class/class_v3.2.0/python/classy.pyx include a call to the above function, lets say called tk_lin() in analogy to pk_lin(),
  • include a call to tk_lin() in boltzmann/class/class_interface.py.
  1. Make the calculation of cmb optional. I found this important when running MCMC for galaxy clustering statistics only, since calculating the Cls makes the MCMC too slow at each step in the chain. So it would be nice in the output list of class_interface.py to have the option of only calculating matter power spectrum and transfer function, 'mPk mTk' as one can do when running class directly.
  2. Would it be possible to have the extrapolation of the transfer function similar to what you have for the power spectrum? This would be helpful when calculating loops in galaxy statistics due to primordial non-Gaussianity, using FFTLog, which requires having kernels (which include the transfer function) at low and high k-values. In my version of cosmosis, I added a function to do this using the extrapolated p(k) and dividing it to primordial power spectrum and then building an interpolator for transfer function using init_interp_2d_akima_grid(), which extends the k-range covered by pk() extrapolator. But this seems too convoluted. There is perhaps a better way of doing this?
@joezuntz
Copy link
Owner

I haven't used Cython at all myself, so don't really know how to do your bullet point (1), but I'd be happy to accept contributions :-)

I can certainly do (2), that's straightforward. Then I can have a play with (3), after (1) is in place.

@amoradinejad
Copy link
Author

Great, thanks for point 2.

As of point 1, I can send you the modified version of classy.pyxd classy.pyx. How's best to send them?

@joezuntz
Copy link
Owner

@amoradinejad if you know how to do a pull request then that's the best way to make sure your contribution is recorded. There's a "fork" button at the top right of the page, if you click that you'll get your own version on github. Then you can push your changes to that changed repository and then make a pull request from the tab with that name.

That's what I'd recommend, since it offer an easy way of reviewing the changes, as well as preserving your authorship of them. But you can also just email me the new versions of the file if you'd prefer not to.

@joezuntz
Copy link
Owner

I've added feature (2) - see the module.yaml file in the class directory for the option names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants