FarrOutLab / GWInferno

GWInferno: Gravitational-Wave Hierarchical Inference with NumPyro
MIT License
14 stars 5 forks source link

Why 4 arguments for bounds when you can use 2? #84

Closed Qazalbash closed 5 months ago

Qazalbash commented 5 months ago

As title says,

https://github.com/FarrOutLab/GWInferno/blob/064bfbd8c346aef9dfeb1982d8d9f7cb2f53b1f3/gwinferno/numpyro_distributions.py#L109

bfarr commented 5 months ago

This allows one to truncate a distribution separate from the domain bounds for the PDF. The low and high arguments set the constraints for the distribution, and numpyro doesn't expect you to request probability densities outside those bounds.

Lets say you want to infer a lower-bound on the primary mass distribution; you'll need to calculate probability densities (which will be 0.) for PE samples and injections below whatever value your MCMC puts the bound at each step. In that case, you're model could look something like this:

alpha = numpyro.sample("alpha", dist.Normal(0, 3))
m_min = numpyro.sample("m_min", dist.Uniform(3., 5.))
m1_dist = Powerlaw(alpha, minimum=m_min, maximum=100., low=3., high=100.)
...