예제 #1
0
파일: KCSD2D.py 프로젝트: pmpod/pykCSD
    def make_b_interp_pot_matrix_2D(self):
        """
        Calculate b_interp_pot_matrix
        """
        (ngx, ngy) = self.space_X.shape
        ng = ngx * ngy
        (nsx, nsy) = self.X_src.shape
        n_src = nsy * nsx

        self.b_interp_pot_matrix = np.zeros((ngx, ngy, n_src))

        for i in xrange(0, n_src):
            # getting the coordinates of the i-th source
            (i_x, i_y) = np.unravel_index(i, (nsx, nsy), order='F')
            y_src = self.Y_src[i_x, i_y]
            x_src = self.X_src[i_x, i_y]
            norms = np.sqrt((self.space_X - x_src)**2
                            + (self.space_Y - y_src)**2)

            self.b_interp_pot_matrix[:, :, i] = dt.generated_potential(
                norms,
                self.dist_max,
                self.dist_table
            )

        self.b_interp_pot_matrix = self.b_interp_pot_matrix.reshape(ng, n_src)
예제 #2
0
파일: KCSD2D.py 프로젝트: lowks/pykCSD
    def calculate_b_pot_matrix_2D(self):
        """
        Calculates b_pot_matrix - matrix containing the values of all
        the potential basis functions in all the electrode positions
        (essential for calculating the cross_matrix).
        """
        n_obs = self.elec_pos.shape[0]
        (nx, ny) = self.X_src.shape
        n = nx * ny

        self.b_pot_matrix = np.zeros((n, n_obs))

        for i in xrange(0, n):
            # finding the coordinates of the i-th source
            i_x, i_y = np.unravel_index(i, (nx, ny))
            src = [self.X_src[i_x, i_y], self.Y_src[i_x, i_y]]

            for j in xrange(0, n_obs):
                # for all the observation points
                # checking the distance between the observation point and
                # the source,
                # calculating the base value
                dist = norm(self.elec_pos[j] - src)

                self.b_pot_matrix[i, j] = dt.generated_potential(
                    dist, self.dist_max, self.dist_table)
예제 #3
0
파일: KCSD3D.py 프로젝트: pmpod/pykCSD
    def make_b_interp_pot_matrix_3D(self):
        (ngx, ngy, ngz) = self.space_X.shape
        ng = ngx * ngy * ngz
        (nsx, nsy, nsz) = self.X_src.shape
        n_src = nsy * nsx * nsz

        self.b_interp_pot_matrix = np.zeros((ngx, ngy, ngz, n_src))

        for i in xrange(0, n_src):
            # getting the coordinates of the i-th source
            i_x, i_y, i_z = np.unravel_index(i, (nsx, nsy, nsz), order='F')
            z_src = self.Z_src[i_x, i_y, i_z]
            y_src = self.Y_src[i_x, i_y, i_z]
            x_src = self.X_src[i_x, i_y, i_z]
            norms = np.sqrt((self.space_X - x_src)**2
                            + (self.space_Y - y_src)**2
                            + (self.space_Z - z_src)**2)

            self.b_interp_pot_matrix[:, :, :, i] = dt.generated_potential(
                norms,
                self.dist_max,
                self.dist_table
            )

        self.b_interp_pot_matrix = self.b_interp_pot_matrix.reshape(ng, n_src)
예제 #4
0
파일: KCSD2D.py 프로젝트: CharlesMei/pykCSD
    def calculate_b_pot_matrix_2D(self):
        """
        Calculates b_pot_matrix - matrix containing the values of all
        the potential basis functions in all the electrode positions
        (essential for calculating the cross_matrix).
        """
        n_obs = self.elec_pos.shape[0]
        (nx, ny) = self.X_src.shape
        n = nx * ny

        self.b_pot_matrix = np.zeros((n, n_obs))

        for i in xrange(0, n):
            # finding the coordinates of the i-th source
            i_x, i_y = np.unravel_index(i, (nx, ny))
            src = [self.X_src[i_x, i_y], self.Y_src[i_x, i_y]]

            for j in xrange(0, n_obs):
                # for all the observation points
                # checking the distance between the observation point and
                # the source,
                # calculating the base value
                dist = norm(self.elec_pos[j] - src)

                self.b_pot_matrix[i, j] = dt.generated_potential(
                    dist,
                    self.dist_max,
                    self.dist_table
                )
예제 #5
0
파일: KCSD1D.py 프로젝트: CharlesMei/pykCSD
    def calculate_b_pot_matrix(self):
        """
        Computes the matrix of potentials generated by every
        source basis function at every electrode position.
        """
        n_obs = self.elec_pos.shape[0]
        nx, = self.X_src.shape
        n = nx

        self.b_pot_matrix = np.zeros((n, n_obs))

        for i in xrange(0, n):
            # finding the coordinates of the i-th source
            src = self.X_src[i]

            for j in xrange(0, n_obs):
                # for all the observation points
                # checking the distance between the observation point
                # and the source, and calculating the base value
                dist = norm(self.elec_pos[j] - src)

                self.b_pot_matrix[i, j] = dt.generated_potential(
                    dist,
                    self.dist_max,
                    self.dist_table
                )
예제 #6
0
파일: KCSD3D.py 프로젝트: heltonmaia/pykCSD
    def make_b_interp_pot_matrix_3D(self):
        (ngx, ngy, ngz) = self.space_X.shape
        ng = ngx * ngy * ngz
        (nsx, nsy, nsz) = self.X_src.shape
        n_src = nsy * nsx * nsz

        self.b_interp_pot_matrix = np.zeros((ngx, ngy, ngz, n_src))

        for i in xrange(0, n_src):
            # getting the coordinates of the i-th source
            i_x, i_y, i_z = np.unravel_index(i, (nsx, nsy, nsz), order="F")
            z_src = self.Z_src[i_x, i_y, i_z]
            y_src = self.Y_src[i_x, i_y, i_z]
            x_src = self.X_src[i_x, i_y, i_z]
            norms = np.sqrt((self.space_X - x_src) ** 2 + (self.space_Y - y_src) ** 2 + (self.space_Z - z_src) ** 2)

            self.b_interp_pot_matrix[:, :, :, i] = dt.generated_potential(norms, self.dist_max, self.dist_table)

        self.b_interp_pot_matrix = self.b_interp_pot_matrix.reshape(ng, n_src)
예제 #7
0
    def make_b_interp_pot_matrix_1D(self):
        """
        Calculate b_interp_pot_matrix
        """
        ngx, = self.space_X.shape
        ng = ngx

        nsx, = self.X_src.shape
        n_src = nsx

        self.b_interp_pot_matrix = np.zeros((ngx, n_src))

        for i in xrange(0, n_src):
            # getting the coordinates of the i-th source
            x_src = self.X_src[i]
            norms = np.sqrt((self.space_X - x_src)**2)
            self.b_interp_pot_matrix[:, i] = dt.generated_potential(
                norms, self.dist_max, self.dist_table)

        self.b_interp_pot_matrix = self.b_interp_pot_matrix.reshape(ng, n_src)
예제 #8
0
파일: KCSD1D.py 프로젝트: CharlesMei/pykCSD
    def make_b_interp_pot_matrix_1D(self):
        """
        Calculate b_interp_pot_matrix
        """
        ngx, = self.space_X.shape
        ng = ngx

        nsx, = self.X_src.shape
        n_src = nsx

        self.b_interp_pot_matrix = np.zeros((ngx, n_src))

        for i in xrange(0, n_src):
            # getting the coordinates of the i-th source
            x_src = self.X_src[i]
            norms = np.sqrt((self.space_X - x_src)**2)
            self.b_interp_pot_matrix[:, i] = dt.generated_potential(
                norms,
                self.dist_max,
                self.dist_table
            )

        self.b_interp_pot_matrix = self.b_interp_pot_matrix.reshape(ng, n_src)
예제 #9
0
    def calculate_b_pot_matrix(self):
        """
        Computes the matrix of potentials generated by every
        source basis function at every electrode position.
        """
        n_obs = self.elec_pos.shape[0]
        nx, = self.X_src.shape
        n = nx

        self.b_pot_matrix = np.zeros((n, n_obs))

        for i in xrange(0, n):
            # finding the coordinates of the i-th source
            src = self.X_src[i]

            for j in xrange(0, n_obs):
                # for all the observation points
                # checking the distance between the observation point
                # and the source, and calculating the base value
                dist = norm(self.elec_pos[j] - src)

                self.b_pot_matrix[i, j] = dt.generated_potential(
                    dist, self.dist_max, self.dist_table)