Esempio n. 1
0
    def test_lfpcalc_calc_lfp_pointsource_moi_00(self):
        """
        Test slice where all layers have same conductivity reproduces
        isotropic case.
        """
        sigma_T = 0.3
        sigma_G = 0.3
        sigma_S = 0.3
        h = 300
        steps = 20
        cell = DummyCell(np.array([[h / 2, h / 2]]))

        in_vivo = lfpcalc.calc_lfp_pointsource(cell.x,
                                               cell.y,
                                               cell.z,
                                               x=0.5,
                                               y=0,
                                               z=1,
                                               sigma=sigma_T,
                                               r_limit=cell.d / 2)
        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell.x,
                                                    cell.y,
                                                    cell.z,
                                                    x=0.5,
                                                    y=0,
                                                    z=1,
                                                    sigma_T=sigma_T,
                                                    sigma_G=sigma_G,
                                                    sigma_S=sigma_S,
                                                    r_limit=cell.d / 2,
                                                    h=h,
                                                    steps=steps)

        np.testing.assert_equal(in_vivo, in_vitro)
Esempio n. 2
0
    def test_lfpcalc_calc_lfp_pointsource_moi_02(self):
        """
        Very close to point source, in vivo and in vitro have similar results,
        e.g., the positions should be adjusted similarly.
        """
        sigma_T = 0.3
        sigma_G = 0.0
        sigma_S = 1.5
        h = 2000
        steps = 20
        cell = DummyCell(z=np.array([[h / 2, h / 2]]))

        in_vivo = lfpcalc.calc_lfp_pointsource(cell.x,
                                               cell.y,
                                               cell.z,
                                               x=0.5,
                                               y=0,
                                               z=h / 2,
                                               sigma=sigma_T,
                                               r_limit=cell.d / 2)
        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell.x,
                                                    cell.y,
                                                    cell.z,
                                                    x=0.5,
                                                    y=0,
                                                    z=h / 2,
                                                    sigma_T=sigma_T,
                                                    sigma_G=sigma_G,
                                                    sigma_S=sigma_S,
                                                    r_limit=cell.d / 2,
                                                    h=h,
                                                    steps=steps)

        np.testing.assert_almost_equal(in_vivo, in_vitro, 4)
Esempio n. 3
0
    def test_lfpcalc_calc_lfp_pointsource_moi_04(self):
        """
        Test that slice with zero-conductivity MEA region (z<0) has twice
        the potential as in vivo case at MEA electrode plane
        """
        sigma_T = 0.3
        sigma_G = 0.0
        sigma_S = 0.3
        h = 200
        steps = 3

        cell = DummyCell(z=np.array([[50, 50]]))

        in_vivo = lfpcalc.calc_lfp_pointsource(cell.x,
                                               cell.y,
                                               cell.z,
                                               x=50.,
                                               y=0,
                                               z=0,
                                               sigma=sigma_T,
                                               r_limit=cell.d / 2)
        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell.x,
                                                    cell.y,
                                                    cell.z,
                                                    x=50,
                                                    y=0,
                                                    z=0,
                                                    sigma_T=sigma_T,
                                                    sigma_G=sigma_G,
                                                    sigma_S=sigma_S,
                                                    r_limit=cell.d / 2,
                                                    h=h,
                                                    steps=steps)

        np.testing.assert_almost_equal(2 * in_vivo, in_vitro, decimal=9)
Esempio n. 4
0
 def test_lfpcalc_calc_lfp_pointsource_00(self):
     """Test that function lfpcalc.calc_lfp_pointsource
     reproduces analytic formula"""
     sigma = 0.3
     cell = DummyCell()
     np.testing.assert_equal(
         1. / (4 * np.pi * sigma),
         lfpcalc.calc_lfp_pointsource(cell,
                                      x=0.5,
                                      y=0,
                                      z=1,
                                      sigma=sigma,
                                      r_limit=cell.d / 2))