Skip to content

Add normalisation flag to constrained prior

When using constrained priors ConstrainedPriorDict.prob is not properly normalised.

In some cases, we know exactly the normalisation factor, e.g., for the following setup the appropriate normalisation factor is two.

mass_1 = Uniform(5, 50)
mass_2 = Uniform(5, 50)
mass_ratio = Constraint(0, 1)

It would be good to enable users to specify the appropriate renormalisation in this case. I imagine the syntax being something like

mass_1 = Uniform(5, 50)
mass_2 = Uniform(5, 50)
mass_ratio = Constraint(0, 1, normalization=2)

Any thoughts?

EDIT:

A potential extension when the normalisation is not known is to keep track of how many samples are rejected when sampling from the prior, e.g., https://git.ligo.org/lscsoft/bilby/blob/master/bilby/core/prior.py#L344. The ratio of proposed points to accepted points will be this normalisation.

I half implemented an attempt to keep track of the fraction of points accepted in !476 (closed), https://git.ligo.org/lscsoft/bilby/blob/prior-jacobians/bilby/core/prior.py#L361.

Edited by Colm Talbot