Skip to content

Bugfix Slabspike Sampling

Rhiannon Udall requested to merge rhiannon.udall/bilby:bugfix-slabspike into master

I found that when calling .sample() with no argument for SlabSpikePrior, it returned an array with one element. This is different from other priors, which just return a float or int.

That is

test = SlabSpike(bilby.core.prior.Uniform(-1, 1, "test"), spike_location=None, spike_height=0.5)
test.sample()

should return a float between -1 and 1, but was instead returning an array whose only element was that float.

This fixes that by checking the original type and, if it is not an array, takes instead the element of the output array (after also checking said output has only one element, as it should).

Edited by Rhiannon Udall

Merge request reports

Loading