def test_truncnorm_prior(self):
"""check truncnorm RV"""
msg = "truncnorm prior: incorrect test {0}"
test_vals = [-0.1, 0.0, 0.5, 1.0, 1.1]
mean, std, low, up = 0.9, 0.1, 0.0, 1.0
a, b = (low - mean) / std, (up - mean) / std
correct = truncnorm(loc=mean, scale=std, a=a, b=b)
for ii, xx in enumerate(test_vals):
assert self.gPrior.pdf(xx) == correct.pdf(xx), msg.format(ii)
评论列表
文章目录