Skip to content
Snippets Groups Projects
Commit e4694f4b authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Merge branch 'beta_prior' into 'master'

Resolve #448 (Beta prior prob method fails on pandas objects)

Closes #448

See merge request lscsoft/bilby!705
parents 29a34a34 84a68cdc
No related branches found
No related tags found
1 merge request!705Resolve #448 (Beta prior prob method fails on pandas objects)
Pipeline #99864 passed with warnings
......@@ -14,4 +14,4 @@ MANIFEST
*.version
*.ipynb_checkpoints
outdir/*
.idea/*
\ No newline at end of file
.idea/*
......@@ -991,15 +991,15 @@ class Beta(Prior):
- betaln(self.alpha, self.beta) - xlogy(self.alpha + self.beta - 1, self.maximum - self.minimum)
# deal with the fact that if alpha or beta are < 1 you get infinities at 0 and 1
if isinstance(val, np.ndarray):
if isinstance(val, (float, int)):
if np.isfinite(_ln_prob) and self.minimum <= val <= self.maximum:
return _ln_prob
return -np.inf
else:
_ln_prob_sub = -np.inf * np.ones(len(val))
idx = np.isfinite(_ln_prob) & (val >= self.minimum) & (val <= self.maximum)
_ln_prob_sub[idx] = _ln_prob[idx]
return _ln_prob_sub
else:
if np.isfinite(_ln_prob) and val >= self.minimum and val <= self.maximum:
return _ln_prob
return -np.inf
def cdf(self, val):
if isinstance(val, (float, int)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment