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

Pyccl.halos.profile #1124

Open
Jane550 opened this issue Sep 22, 2023 · 6 comments
Open

Pyccl.halos.profile #1124

Jane550 opened this issue Sep 22, 2023 · 6 comments

Comments

@Jane550
Copy link

Jane550 commented Sep 22, 2023

Hi all! I want to compute the excess surface density of an NFW halo analytically using pyccl.halos.profile package. I now use 'HaloProfileNFW.cumul2d()-HaloProfileNFW.projected()'. Is it the right way to do it or is there any other simpler way? Also I want to check whether 'cumul2d' and 'projected' return the comoving or physical surface density.

@hsinfan1996
Copy link
Contributor

hsinfan1996 commented Sep 22, 2023

I believe using cumul2d - projected is the only way to obtain the excess surface density profile. The functions return comoving density.

@Jane550
Copy link
Author

Jane550 commented Sep 24, 2023

Sure, Many thanks!

@Jane550 Jane550 closed this as completed Sep 24, 2023
@Jane550 Jane550 reopened this Nov 27, 2023
@Jane550
Copy link
Author

Jane550 commented Nov 27, 2023

Hi! I want to return an array 'ESD=cumul2d-projected' of size n for input of arrays 'M','z','R' all of the size n. i.e. for each combination of 'M,z,R', I got an ESD. Now the code seems to return an array of shape (N_M,N_R) where N_M, N_R are the length of the input arrays 'M','R'. But in my case, Each M corresponds to an array of R with different shapes and values so I don't think the current code is suitable. Is there anywhere in the code that I can modify to simply return an array the same size as the input 'M','z', and 'R'? If not, can you please give me the analytical form of ESD of an untruncated NFW profile? I may try writing a code myself.

@damonge
Copy link
Collaborator

damonge commented Nov 27, 2023

Hi @Jane550 . Yes, the way the current code is structured is optimized for halo model power spectrum/correlation function calculations, which calculate all the possible combinations between M and r. For your case, would calling cumul2d inside a loop that runs over the different values of M, R, and z work? Or would that be too slow? My first guess is that the time wasted in looping would be small compared to evaluating the expressions that go into cumul2d, so perhaps it's not the worst solution...

@Jane550
Copy link
Author

Jane550 commented Nov 27, 2023

No, the loop is too slow. I'm calculating the ESD as model predictions in a Bayesian parameter inference, so I need to calculate these many many times. And each time calling the likelihood (calculating the ESD), the length of $M,R,z$ is of order $10^7$.

@damonge
Copy link
Collaborator

damonge commented Nov 27, 2023

OK, I see. I think the easiest option for now would be for you to hack/reimplement this function:

def _cumul2d_analytic(self, cosmo, r, M, a):

which implements the ESD of an NFW profile. Would that work?

Once you have that, we may be able to put it back into CCL (although it'd be great to think of a way to do it that is completely generalisable to the other profiles - including those in which the calculation needs to go through FFTLog).

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

3 participants