-
Notifications
You must be signed in to change notification settings - Fork 81
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
DEV: make sure all priors return float when needed #848
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # bilby/core/utils/calculus.py
I've double checked the Fermi-Dirac prior CDF and it gives the correct expected result. |
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, I just have a couple of questions before I approve.
for names in joint.values(): | ||
values = list() | ||
for key in names: | ||
values = np.concatenate([values, result[key]]) | ||
for key, value in zip(names, values): | ||
result[key] = value |
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.
Could you help me understand what this loop is doing? I'm finding the logic of this part a bit hard to follow, it might benefit from a comment.
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.
+1
def test_cdf_float_with_float_input(self): | ||
for prior in self.priors: | ||
if ( | ||
bilby.core.prior.JointPrior in prior.__class__.__mro__ |
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.
Why is this test skipped for JointPriors with no finite upper bound?
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.
Left a few questions in the code. Wondering what github will do when I press "submit review" with "request changes" chosen.
@ColmTalbot it looks like there are conflicts following #849 |
For a long time, some prior classes have cast inputs to numpy arrays this MR removes that behaviour and adds a test to make sure that sampling and evaluating the CDF do not cast to array.
This caused an error when evaluating the CDF many times and then combining the results.
I also streamlined some other behaviour in applying prior constraints that were originally flagged by @cjhaster.
I noticed that the Fermi-Dirac CDF hadn't been implemented for some reason so I added that and added to the CI test suite.
Finally, there was an issue with sampling from joint distributions where the results could be returned out of order.
Copied from https://git.ligo.org/lscsoft/bilby/-/merge_requests/1285