How to use the elephant.current_source_density_src.utility_functions function in elephant

To help you get started, we’ve selected a few elephant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NeuralEnsemble / elephant / elephant / current_source_density.py View on Github external
CC and EH developed the interface to elephant.
"""

from __future__ import division

import neo
import quantities as pq
import numpy as np
from scipy import io
from scipy.integrate import simps

from elephant.current_source_density_src import KCSD
from elephant.current_source_density_src import icsd
import elephant.current_source_density_src.utility_functions as utils

utils.patch_quantities()

available_1d = ['StandardCSD', 'DeltaiCSD', 'StepiCSD', 'SplineiCSD', 'KCSD1D']
available_2d = ['KCSD2D', 'MoIKCSD']
available_3d = ['KCSD3D']

kernel_methods = ['KCSD1D', 'KCSD2D', 'KCSD3D', 'MoIKCSD']
icsd_methods = ['DeltaiCSD', 'StepiCSD', 'SplineiCSD']

py_iCSD_toolbox = ['StandardCSD'] + icsd_methods


def estimate_csd(lfp, coords=None, method=None,
                 process_estimate=True, **kwargs):
    """
    Fuction call to compute the current source density (CSD) from extracellular
    potential recordings(local-field potentials - LFP) using laminar electrodes
github NeuralEnsemble / elephant / elephant / current_source_density_src / KCSD.py View on Github external
source_type : basis_fuctions.basis_1D.keys()
        self.R based on R_init
        self.dist_max as maximum distance between electrode and basis
        self.nsx = self.src_x.shape
        self.src_x : Locations at which basis sources are placed.
        Parameters
        ----------
        None
        """
        source_type = self.src_type
        try:
            self.basis = basis.basis_1D[source_type]
        except KeyError:
            raise KeyError('Invalid source_type for basis! available are:',
                           basis.basis_1D.keys())
        (self.src_x, self.R) = utils.distribute_srcs_1D(self.estm_x,
                                                        self.n_src_init,
                                                        self.ext_x,
                                                        self.R_init )
        self.n_src = self.src_x.size
        self.nsx = self.src_x.shape
github NeuralEnsemble / elephant / elephant / current_source_density_src / KCSD.py View on Github external
source_type : basis_fuctions.basis_2D.keys()
        self.R based on R_init
        self.dist_max as maximum distance between electrode and basis
        self.nsx, self.nsy = self.src_x.shape
        self.src_x, self.src_y : Locations at which basis sources are placed.
        Parameters
        ----------
        None
        """
        source_type = self.src_type
        try:
            self.basis = basis.basis_2D[source_type]
        except KeyError:
            raise KeyError('Invalid source_type for basis! available are:',
                           basis.basis_2D.keys())
        (self.src_x, self.src_y, self.R) = utils.distribute_srcs_2D(self.estm_x,
                                                                    self.estm_y,
                                                                    self.n_src_init,
                                                                    self.ext_x,
                                                                    self.ext_y,
                                                                    self.R_init )
        self.n_src = self.src_x.size
        self.nsx, self.nsy = self.src_x.shape
github NeuralEnsemble / elephant / elephant / current_source_density_src / KCSD.py View on Github external
source_type : basis_fuctions.basis_2D.keys()
        self.R based on R_init
        self.dist_max as maximum distance between electrode and basis
        self.nsx, self.nsy, self.nsz = self.src_x.shape
        self.src_x, self.src_y, self.src_z : Locations at which basis sources are placed.
        Parameters
        ----------
        None
        """
        source_type = self.src_type
        try:
            self.basis = basis.basis_3D[source_type]
        except KeyError:
            raise KeyError('Invalid source_type for basis! available are:',
                           basis.basis_3D.keys())
        (self.src_x, self.src_y, self.src_z, self.R) = utils.distribute_srcs_3D(self.estm_x,
                                                                                self.estm_y,
                                                                                self.estm_z,
                                                                                self.n_src_init,
                                                                                self.ext_x,
                                                                                self.ext_y,
                                                                                self.ext_z,
                                                                                self.R_init)

        self.n_src = self.src_x.size
        self.nsx, self.nsy, self.nsz = self.src_x.shape
github NeuralEnsemble / elephant / elephant / current_source_density_src / KCSD.py View on Github external
"""Basic checks to see if inputs are okay

        Parameters
        ----------
        ele_pos : numpy array
            positions of electrodes
        pots : numpy array
            potentials measured by electrodes
        """
        if ele_pos.shape[0] != pots.shape[0]:
            raise Exception("Number of measured potentials is not equal "
                            "to electrode number!")
        if ele_pos.shape[0] < 1+ele_pos.shape[1]: #Dim+1
            raise Exception("Number of electrodes must be at least :",
                            1+ele_pos.shape[1])
        if utils.contains_duplicated_electrodes(ele_pos):
            raise Exception("Error! Duplicated electrode!")