def test_2D(self):

        # #%% AstraProjectorSimple cpu
        ig = self.ig_2D.copy()
        ag = self.ag_slice.copy()

        A = AstraProjectorSimple(ig, ag, device='cpu')
        fp = A.direct(self.golden_data_cs)
        bp = A.adjoint(fp)

        #%% AstraProjectorSimple gpu
        ig = self.ig_2D.copy()
        ag = self.ag_slice.copy()

        A = AstraProjectorSimple(ig, ag, device='gpu')
        fp_gpu = A.direct(self.golden_data_cs)
        bp_gpu = A.adjoint(fp_gpu)

        np.testing.assert_allclose(fp_gpu.as_array(), fp.as_array(), atol=0.8)
        np.testing.assert_allclose(bp_gpu.as_array(), bp.as_array(), atol=12)

        # #%% AstraProjectorFlexible as a 2D
        ig = self.ig_2D.copy()
        ag = self.ag_slice.copy()

        A = AstraProjectorFlexible(ig, ag)
        fp_flex = A.direct(self.golden_data_cs)
        bp_flex = A.adjoint(fp_flex)

        np.testing.assert_allclose(fp_flex.as_array(), fp.as_array(), atol=0.8)
        np.testing.assert_allclose(bp_flex.as_array(), bp.as_array(), atol=12)
    def test_consistency(self):

        # #%% AstraProjectorSimple cpu
        ig = self.ig_2D.copy()
        ag = self.ag_slice.copy()

        A = AstraProjectorSimple(ig, ag, device='cpu')
        fp = A.direct(self.golden_data_cs)
        bp = A.adjoint(fp)

        # #%% AstraProjectorFlexible
        ig = self.ig_3D.copy()
        ag = self.ag.copy()

        A = AstraProjector3DSimple(ig, ag)
        flex_fp = A.direct(self.golden_data)
        flex_bp = A.adjoint(flex_fp)

        #comparision foward projection
        fp_flex_0 = flex_fp.subset(vertical=self.cs_ind, force=True)
        fp_flex_1 = flex_fp.subset(vertical=self.cs_ind + 3, force=True)
        fp_flex_2 = flex_fp.subset(vertical=self.cs_ind - 3, force=True)

        zeros = self.ag_slice.allocate(0)
        np.testing.assert_allclose(fp_flex_0.as_array(),
                                   fp.as_array(),
                                   atol=0.8)
        np.testing.assert_allclose(fp_flex_1.as_array(),
                                   fp.as_array(),
                                   atol=0.8)
        np.testing.assert_allclose(fp_flex_2.as_array(), zeros.as_array())

        #comparision back projection
        bp_flex_0 = flex_bp.subset(vertical=self.cs_ind, force=True)
        bp_flex_1 = flex_bp.subset(vertical=self.cs_ind + 3, force=True)
        bp_flex_2 = flex_bp.subset(vertical=self.cs_ind - 3, force=True)

        zeros = self.ig_2D.allocate(0)
        np.testing.assert_allclose(bp_flex_0.as_array(),
                                   bp.as_array(),
                                   atol=12)
        np.testing.assert_allclose(bp_flex_1.as_array(),
                                   bp.as_array(),
                                   atol=12)
        np.testing.assert_allclose(bp_flex_2.as_array(), zeros.as_array())