manodeep / Corrfunc

⚡️⚡️⚡️Blazing fast correlation functions on the CPU.
https://corrfunc.readthedocs.io
MIT License
165 stars 50 forks source link

Distance units in mocks #202

Open Christopher-Bradshaw opened 4 years ago

Christopher-Bradshaw commented 4 years ago

Hey, a couple of questions about the distance units in the mocks package (particularly DDrppi_mocks).

From a couple of tests it looks like both the pi and r distances in which pairs are found are comoving distances? Where (assuming a flat cosmology) the r distance is the comoving distance * angle?

It also looks like those distances are assumed to be in comoving Mpc/h if is_comoving_dist isn't set? (https://github.com/manodeep/Corrfunc/blob/d8a795859dc9a66b112c539f82da650fa0b8e586/utils/set_cosmo_dist.c#L39 though this says Mpc https://github.com/manodeep/Corrfunc/blob/d8a795859dc9a66b112c539f82da650fa0b8e586/utils/set_cosmo_dist.c#L68)

I'm guessing though if is_comoving_dist is set, and the CZ are passed in as Mpc that r/pi are also then assumed to be in units of comoving Mpc.

If this is right so far, is there any way to pass a physical bin size? E.g. if we want counts within 10 physical Mpc over a large redshift range?

Thanks for all your help! I'm also happy to help put some of this in the docs if it is right and you think it would help others.

manodeep commented 4 years ago

@Christopher-Bradshaw Thanks for opening the issue. Assuming is_comoving_dist is not set, the velocity units for cz is assumed to be km/s and the distance units for the bins (in both r_p and pi) are all assumed to be in Mpc/h. I am fairly certain that the fprintf statement is a bug and should read Mpc/h instead of Mpc.

If is_comoving_dist is set, then the units for the bins are assumed to be self-consistent and could be in arbitrary units (similar to how the theory pair-counters operate).

@Christopher-Bradshaw For the second question, do you want all pairs within r_p = 10 Mpc (i.e., a single r_p bin) or do you mean all pairs within pi = 10 Mpc?

Christopher-Bradshaw commented 4 years ago

Thanks for the response, that makes sense.

For the second question, both. I want all pairs within a single r_p bin (lets say of 1Mpc) and a single pi bin (lets say 10 Mpc). But I want those to be physical Mpc rather than comoving (i.e. the comoving distances will change as a function of redshift).

manodeep commented 4 years ago

@Christopher-Bradshaw I am still not sure I understand. Are you proposing to calculate physical separations between arbitrary points within the kernel?

patogallardo commented 2 years ago

Related to this question.

If you go to the link below in the docs, the first parenthesis states: (speed of light times redshift, in Mpc/h).

Is this a mistake? I think it should read "speed of light in km/s times z", based in the discussion above.

Thank you!

https://corrfunc.readthedocs.io/en/master/python-interface.html?highlight=cz#calculating-2-d-pair-counts-corrfunc-mocks-ddsmu-mocks

manodeep commented 2 years ago

@patogallardo Took me a while to get to but looks like the documentation is correct - these lines do the distance calculation. Particularly, these two lines effectively multiply the integral with c/H0, and that produces d in co-moving Mpc/h units.