-
Notifications
You must be signed in to change notification settings - Fork 79
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
[BUG] relative binning - correctly set last bin index #48
Conversation
Hi @noahewolfe, can you provide a failing example, ideally in a way we can add to unit tests, or at least so that people can come back and reproduce this later? |
Thanks @noahewolfe; I thought I had taken care of these issues in https://git.ligo.org/lscsoft/bilby/-/merge_requests/1310, but clearly not. As Colm said, an example and unit test would be very helpful. |
Can do! I wrote up something, copying in large part the existing relative binning unit test (this one) to construct a unit test, which should also provide an example. I'll leave the exact code example at the very bottom, as it's a bit long right now. This isn't exactly what I was working with when I first reported this bug, but, it reproduces the same error, namely:
When I include the fix in this pull request, the tests both pass. Here's my go at a unit test; if this kind of thing looks good, I can update the pull request with this as a new file under
|
Thanks @noahewolfe! I think I misunderstood the problem earlier. I think this fix is great. For the unit test, I don't think we need an extra test class---I'd just simply replace the test parameters here with one for a subsolar mass system. |
Also, I think the prior width you have in your example is okay, since at those masses an SSM candidate would have a chirp mass posterior that fits within that prior (and hence log-likelihood would vary quite a bit). In fact, my fear was the prior was too wide, but that doesn't seem to be the case at least with the tests you ran. |
I would vote for adding another test case using the same code over replacing the existing one. The existing one clearly probes different behaviour! |
I kinda thought if the parameters are changed to be consistent with subsolar mass, it would be a superset of things we were testing for currently. But maybe I am missing something. |
We're presumably currently testing a case where
I think this corresponds to the waveform not extending as far as the maximum frequency. The change here is for the waveform extending beyond the maximum frequency. I think both of these cases are worth including in the tests, maybe not the full set of tests, but at least verifying that the binning scheme can be set up and a likelihood can be evaluated. |
@noahewolfe is there anything you need to get moving with the tests? |
Hi Colm/all, sorry for the delay! I'm working on this now. I'll incorporate the relevant test as an additional method of the |
If the last bin index is already chosen to be the last point in the frequency array, we shouldn't increment by 1, else we have an invalid index.
If the last bin index is already chosen to be the last point in the frequency array, we shouldn't increment by 1, else we have an invalid index.
I observed this with very long injections that have power even at the maximum frequency, and thus, the bin selection will already include the last frequency point in the bin indices.