-
Notifications
You must be signed in to change notification settings - Fork 68
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
Power spectrum responses for SSC #1134
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 9625354277Details
💛 - Coveralls |
@RyoTerasawa can I check what the status of this PR is? |
I am waiting for someone to review the code. I haven't asked for a specific person yet, but maybe I should ask a member of the MCPCov group to review it. I am happy to explain the details if needed. I am also working on writing the unit test and benchmark test to be included in this PR. |
@RyoTerasawa @YueNan-c, maybe you want to also implement the DarkEmulator here: https://github.com/LSSTDESC/CCL/blob/master/pyccl/emulators/cosmicemu_pk.py. Are the unit tests and benchmark ready? |
@RyoTerasawa @carlosggarcia can I check what the status of this is? |
@carlosggarcia @damonge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I first round of comments. Some suggestions:
- Add unit tests per function/method declared to be sure they are doing what they should
- I would unify the
.npy
files in a single.npz
file. Also, it seems that you are only using the z=0 case, I'd be great if you can compare all redshift, since you have it. - Add References to the equations in your paper for later reference (and to make my life easier when reviewing the PR)
- @damonge, there are integrals and biases computed that I think they might be obtained from the current CCL implementation. Can you have a look? The are in
pkresponse.py
, where I pinged you, too.
In general, it looks good, though! Good work!
def test_Pmm_resp(): | ||
response = Pmm_resp(cosmo, deltah=deltah, lk_arr=lk_arr, a_arr=a_arr) | ||
|
||
assert np.all(np.isfinite(response)), "Pmm_resp produced infinity values." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this "Pmm_resp produced infinity values." doing?
def Pmm_resp( | ||
cosmo, | ||
deltah=0.02, | ||
extra_parameters={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren't used anywhere.
|
||
|
||
def set_hmodified_cosmology(cosmo, deltah): | ||
Omega_c = cosmo["Omega_c"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, and what if there are extra parameters given, eg. massive neutrinos? Wouldn't that be relevant? I guess you should make sure the cosmology object is exactly the same, except for the h
return b2 | ||
|
||
|
||
def darkemu_set_cosmology(emu, cosmo): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add and underscore if these methods are meant to be private (so not used by other libraries); e.g. _darkemu_set_cosmology
. Also, add documentation. Same with the other "utility functions".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, you should add a unit test for each function that you have defined in pkresponse.py
to check that they are working properly. For instance, for set_hmodified_cosmology
you would like to check that the output cosmologies are exactly the same as the input one, except for the h's.
|
||
kmin = 1e-2 | ||
for ia, aa in enumerate(a_arr): | ||
pk = pk2d.__call__(k_use, aa, cosmo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to use __call__
, you can just call it, pk2d(k_use, aa, cosmo)
hbf = halos.HaloBiasTinker10(mass_def=mass_def) | ||
|
||
# dark emulator is valid for 0 =< z <= 1.48 | ||
if np.any(1.0 / a_arr - 1) > 1.5: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the maximum is 1.48, check for 1.48, not 1.5
|
||
# dark emulator is valid for 0 =< z <= 1.48 | ||
if np.any(1.0 / a_arr - 1) > 1.5: | ||
print("dark emulator is valid for z={:.2f}<1.48") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, what does {:.2f}
do here? I think you have to remove that.
/ ng | ||
) | ||
|
||
bgE2 = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@damonge , can this be done with the current methods of the halo model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with the other integrals
# Construct the full path for each data file (z=0) | ||
k_data_path = os.path.join(data_directory_path, "k_h.npy") | ||
k_data_mm_path = os.path.join(data_directory_path, "k_h_mm.npy") | ||
Pmm_resp_data_path = os.path.join(data_directory_path, "Pmm_resp_z0.npy") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have so much more data generated, at different redshifts. Why don't you use it?
@carlosggarcia @RyoTerasawa can I check what the status of this PR is? |
In pyccl/pkresponse.py, I implemented the functions to calculate power spectrum responses to the super-survey modes which are responsible for super-sample covariance (SSC), based on arXiv:2310.13330.
We approximate the power spectrum growth response to the super-survey modes by its growth response to the Hubble parameter.
For the galaxy-matter and galaxy-auto power spectra, the halo statistics (halo-matter/halo-auto power spectrum, mass function) are calculated by DarkEmulator.