Skip to content

Commit

Permalink
Get rid of needless renormalization error, fixes mwshinn#43
Browse files Browse the repository at this point in the history
  • Loading branch information
mwshinn committed Dec 1, 2021
1 parent d5d7747 commit 7272e63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ddm/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ def resample(self, k=1, seed=0):
shift = np.max(shorter_t_domain)+1
combined_domain = list(shorter_t_domain) + list(shorter_t_domain+shift) + [-1]
combined_probs = list(shorter_pdf_corr*self.model.dt) + list(shorter_pdf_err*self.model.dt) + [self.prob_undecided()]
if fsum(combined_probs) != 1:
print("Warning, distribution sums to %f rather than 1" % fsum(combined_probs))
if np.abs(np.sum(combined_probs)-1) >= .0001:
print("Warning, distribution sums to %f rather than 1" % np.sum(combined_probs))
samp = np.random.choice(combined_domain, p=combined_probs, replace=True, size=k)
undecided = np.sum(samp==-1)
samp = samp[samp != -1] # Remove undecided trials
Expand Down

0 comments on commit 7272e63

Please sign in to comment.