Closed MaverickMeerkat closed 2 years ago
Looking back on this, I think I missed the fact that the angle has a minus in front of it - so s=c=1/sqrt(2) and there's no problem in the code. (though it's a bit cumbersome with all the s, c and angles...)
I remove this issue.
https://github.com/mackelab/delfi/blob/62a99a879145bdc675917fc33eed69293b964048/delfi/simulator/TwoMoons.py#L115
Inverting equation (26) in the paper "Automatic Posterior Transformation for Likelihood-free Inference", we get: p_0 \frac{|\theta_0 + \theta_1|}{\sqrt2}=x_0 p_1 + \frac{-\theta_0 + \theta_1}{\sqrt2}=x_1
Moving sides and defining the rhs as q's: \frac{|\theta_0 + \theta_1|}{\sqrt2}=p_0-x_0:=q_0 \frac{-\theta_0 + \theta_1}{\sqrt2}=x_1-p_1:=q_1 \frac{\theta_0 + \theta_1}{\sqrt2}= \pm q_0
subtracting/adding to cancel the variables we get: \sqrt2 \theta_1=\pm q_0 + q_1 \sqrt2\theta_0=\pm q_0 - q_1
Now
c
is simply 1/\sqrt2, ands
is -1/\sqrt2. So it comes out that the code is putting theta1 in theta0, and putting -theta0 in theta1.