Open bilby-bot opened 2 months ago
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.
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.
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:
With an example of an "invalid prior":
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.