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

Bilby freezes when invalid values are passed to prior constraints #817

Open
bilby-bot opened this issue Sep 5, 2024 · 1 comment · May be fixed by #853
Open

Bilby freezes when invalid values are passed to prior constraints #817

bilby-bot opened this issue Sep 5, 2024 · 1 comment · May be fixed by #853
Labels
10-100 lines bug Something isn't working

Comments

@bilby-bot
Copy link
Collaborator

In GitLab by @git.ligo:alexandresebastien.goettel on Sep 5, 2024, 16:44

Small thing but I noticed that the code will completely freeze when trying to sample from a prior with invalid constraints.

The following code can be used to reproduce the issue:

prior = bilby.gw.prior.BBHPriorDict("invalid.prior")`
parameters = prior.sample()

With an example of an "invalid prior":

mass_1 = Constraint(name='mass_1', minimum=1, maximum=10)
mass_2 = Constraint(name='mass_2', minimum=1, maximum=10)
mass_ratio = bilby.gw.prior.UniformInComponentsMassRatio(name='mass_ratio', minimum=0.8, maximum=1)
chirp_mass = bilby.gw.prior.UniformInComponentsChirpMass(name='chirp_mass', minimum=80, maximum=120)

Obviously the user is doing something wrong here, but I think that a better approach would be to raise an ValueError (or a custom InvalidPriorError) with a corresponding message? If so I'm of course happy to open an MR.

@bilby-bot
Copy link
Collaborator Author

In GitLab by @git.ligo:colm.talbot on Sep 19, 2024, 16:28

We should issue a warning if the efficiency is worse than some threshold, e.g., 1e-3. This is the spot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10-100 lines bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant