Inconsistent output types for `pesummary.utils.credible_interval.credible_interval`
I have noticed that the output type of pesummary.utils.credible_interval.credible_interval
and Array.credible_interval
can vary depending on whether weights are provided or not. This can be reproduced with the code below:
from pesummary.utils.credible_interval import credible_interval
from pesummary.utils.array import Array
import numpy as np
x = Array(np.random.uniform(0, 1, size=10000))
print("percentile float", credible_interval(x, percentile=95), x.credible_interval(percentile=95))
print("percentile list", credible_interval(x, percentile=[95]), x.credible_interval(percentile=[95]))
y = Array(x, weights=np.ones_like(x))
print("percentile float with weights provided", credible_interval(y, percentile=95, weights=y.weights), y.credible_interval(percentile=95))
print("percentile 1d list with weights provided", credible_interval(y, percentile=[95], weights=y.weights), y.credible_interval(percentile=[95]))
with output:
percentile float 0.9482326768038033 0.9482326768038033
percentile list [0.94823268] [0.94823268]
percentile float with weights provided 0.9482232296332501 0.9482232296332501
percentile 1d list with weights provided 0.9482232296332501 [0.94822323]
It would be preferred if the output remained consistent with the type of percentile
. I am currently running:
$ summaryversion
1.1.1
Edited by Charlie Hoy