def test_log_S_i(self, Xa, Xb, model):
        model.sample()
        R = np.linspace(-np.pi, np.pi, 361)
        log_S = np.empty(R.size * 2)

        for i, r in enumerate(R):
            Xr = Xa.copy_from_vertices()
            Xr.rotate(np.degrees(r))
            log_S[2*i] = log_similarity(
                Xr.vertices, Xb.vertices, model.opts['S_sigma'])

            Xr = Xa.copy_from_vertices()
            Xr.flip(np.array([0, 1]))
            Xr.rotate(np.degrees(r))
            log_S[2*i + 1] = log_similarity(
                Xr.vertices, Xb.vertices, model.opts['S_sigma'])

        assert np.allclose(log_S, model.log_S_i)
    def test_log_S_i(self, Xa, Xb, model):
        model.sample()
        R = model.R_i
        F = model.F_i
        log_S = np.empty_like(R)

        for i, (r, f) in enumerate(zip(R, F)):
            Xr = Xa.copy_from_vertices()
            if f == 1:
                Xr.flip(np.array([0, 1]))
            Xr.rotate(np.degrees(r))
            log_S[i] = log_similarity(
                Xr.vertices, Xb.vertices, model.opts['S_sigma'])

        assert np.allclose(log_S, model.log_S_i)
    def test_similarity(self, Xa, Xb, model):
        log_S = log_similarity(Xb.vertices, Xa.vertices, model.opts["S_sigma"])
        assert log_S == model.model["log_S"].logp

        log_S = log_similarity(model.model["Xb"].value, model.model["Xr"].value, model.opts["S_sigma"])
        assert log_S == model.model["log_S"].logp