-
Notifications
You must be signed in to change notification settings - Fork 65
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
Fix WL functions in pyccl.halos.profiles #943
Conversation
Pull Request Test Coverage Report for Build 2510576231
💛 - Coveralls |
@hsinfan1996 thanks for this. Just so I'm clear, what fails exactly when you make |
In convergence and shear, the first step |
OK, I see! For practical applications, how inconvenient is it that |
From what I know, that |
Humm, but if I understand correctly, from now on, a_source will always need to have the same shape as r, right? I think this is very non-desirable. Could we force both a_source and a_lens to be scalars in that case? |
For array_like |
OK, but the only two possibilities are: I think option b) above is not useful at all (and is not documented as such), so I can see two ways forward:
Option 1 above seems to be the simplest one, so I'd advocate for that unless you feel like giving the second one a go. |
Actually, b) is what I wanted to achieve in this PR and is already very useful to us. In addition, it only requires a few lines of code added to pyccl to allow array_like |
Humm, I don't really understand how b) is useful at all. Why is it useful to have the function return e.g. convergence as a function of (r,a_source) where each r corresponds to a different a_source? Wouldn't it be more useful to have it as a function of both r and a_source independently of each other? |
(I don't think the latter would require c-level modifications, BTW, that's why I'm asking) |
For what I understand, in CLMM, we want to make computations considering several sources with different projected radius but in the same redshift, therefore same a_source, or to make computations for several sources in different redshifts. That is why we wanted the case b). Either each projected radius must have a pair, thus len(r) = len(a_source), or we are giving several projected radius but we want to analyze all sources in the same redshift, which then requires I feel like the case where, for example, r = [1,2,3] and a_source = [0.5, 0.4] is not very usefull because it is not clear what this stands for. When we give an array We did implement these changes in CLMM after importing the CCL functions but we've come up with two problems: 1) the vectorization on our end let the code very slow. 2)Even though the calculations were feasible, we got a failled test because |
Thanks @eduardojsbarroso
This would give you the profile at r=[1, 2, 3] for two sources, one at a=0.5 and one at a=0.4. Isn't this more useful than e.g. having the profile for e.g. r=1 at a=0.4, r=2 at a=0.5, and r=3 at a=0.6? I had assumed you'll want to do some line-of-sight integrals that involve integrating over source redshifts for the same lens, and that's why I thought that having r and a_source be independent would be useful, but I'm probably wrong. Can I check what calculation is it that benefits from having r and a_source coupled? |
(I should say, I don't want to delay this getting merged, just want to make sure I'm on the same page!) |
https://github.com/LSSTDESC/CLMM/blob/fc813c348fceab0b009f39bd4472af244fba9693/clmm/theory/parent_class.py#L490 I still agree that allowing |
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.
Thanks @hsinfan1996 @eduardojsbarroso , if this is actually what you guys need, let's move on with it. Thanks for indulging me!
Just one final query to fix the docs while we're at it and we can merge
@damonge Thank you for reviewing and the conversation. @nikfilippas Thank you. |
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.
LGTM!
In pyccl.halos.profiles, convergence, shear, reduced_shear and magnification can now handle array_like a_source.