Two Moons

Mathematical Set-Up

Given θR2, produces data yR2 as follows aU(π2,π2)rN(0.1,0.012)p=(rcos(a)+0.25,rsin(a))y=p+(|θ1+θ2|2,θ1+θ22)

Coding

def TM_simulator(theta):
    """Two Moons simulator for ABC."""
    t0, t1 = theta[0], theta[1]
    a = uniform(low=-np.pi/2, high=np.pi/2)
    r = normal(loc=0.1, scale=0.01)
    p = np.array([r * np.cos(a) + 0.25, r * np.sin(a)])
    return p + np.array([-np.abs(t0 + t1), (-t0 + t1)]) / sqrt(2)
Previous
Next