Skip to content

Conversation

@vivienr
Copy link
Contributor

@vivienr vivienr commented Dec 18, 2025

prior.sample() seems to always trigger the warning:

bilby WARNING : Prior sampling efficiency is very low, please verify its validity.

when using a prior with keys, without Constraints, and requesting more than 1000 samples. E.g.:

import bilby
prior=bilby.core.prior.PriorDict({'param1':bilby.core.prior.Uniform(minimum=5, maximum=50)})
samples=prior.sample(1001)

(And for some parallel workflows keeps triggering the warning).

This seems to stem from evaluate_constraints() which defaults to returning a single 1 when there aren't Constraints (instead of an array of ones), which is then used to count the number of valid samples (n_valid_samples), returning always 1, and thus triggering the warning once one asks for more than 1000 samples (if n_tested >= 1e3 and efficiency < 1e-3: in check_efficiency()).

The solution proposed here is to replace evaluate_constraints()'s default prob to be an array of ones like the first values in out_samples.

Copy link
Collaborator

@ColmTalbot ColmTalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants