Skip to content
Snippets Groups Projects

Fix problem with Prior prob and ln_prob if passing multiple samples

Merged Matthew David Pitkin requested to merge matthew-pitkin/bilby:fix_prior into master
All threads resolved!
1 file
+ 6
6
Compare changes
  • Side-by-side
  • Inline
+ 6
6
@@ -277,10 +277,10 @@ class PriorDict(OrderedDict):
else:
return 0.
else:
cprob = np.zeros_like(prob)
constrained_prob = np.zeros_like(prob)
keep = np.array(self.evaluate_constraints(sample), dtype=bool)
cprob[keep] = prob[keep]
return cprob
constrained_prob[keep] = prob[keep]
return constrained_prob
def ln_prob(self, sample, axis=None):
"""
@@ -310,10 +310,10 @@ class PriorDict(OrderedDict):
else:
return -np.inf
else:
cln_prob = -np.inf * np.ones_like(ln_prob)
constrained_ln_prob = -np.inf * np.ones_like(ln_prob)
keep = np.array(self.evaluate_constraints(sample), dtype=bool)
cln_prob[keep] = ln_prob[keep]
return cln_prob
constrained_ln_prob[keep] = ln_prob[keep]
return constrained_ln_prob
def rescale(self, keys, theta):
"""Rescale samples from unit cube to prior
Loading