Commit f6091e88 authored by Philipp Arras's avatar Philipp Arras
Browse files

Fix bug in posterior sampling

parent a2796f3e
Pipeline #24387 passed with stage
in 6 minutes and 13 seconds
...@@ -78,6 +78,6 @@ if __name__ == "__main__": ...@@ -78,6 +78,6 @@ if __name__ == "__main__":
sample_variance = ift.Field.zeros(s_space) sample_variance = ift.Field.zeros(s_space)
sample_mean = ift.Field.zeros(s_space) sample_mean = ift.Field.zeros(s_space)
mean, variance = ift.probe_with_posterior_samples(D, ht, 50) mean, variance = ift.probe_with_posterior_samples(D, sh, ht, 50)
ift.plot(variance, name="posterior_variance.png", colormap="Planck-like") ift.plot(variance, name="posterior_variance.png", colormap="Planck-like")
ift.plot(mean, name="posterior_mean.png", **plotdict) ift.plot(mean, name="posterior_mean.png", **plotdict)
...@@ -47,10 +47,10 @@ class StatCalculator(object): ...@@ -47,10 +47,10 @@ class StatCalculator(object):
return self._M2 * (1./(self._count-1)) return self._M2 * (1./(self._count-1))
def probe_with_posterior_samples(op, post_op, nprobes): def probe_with_posterior_samples(op, m, post_op, nprobes):
sc = StatCalculator() sc = StatCalculator()
for i in range(nprobes): for i in range(nprobes):
sample = post_op(op.generate_posterior_sample()) sample = post_op(op.generate_posterior_sample() + m)
sc.add(sample) sc.add(sample)
if nprobes == 1: if nprobes == 1:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment