Current source density analysis¶
‘Current Source Density analysis (CSD) is a class of methods of analysis of extracellular electric potentials recorded at multiple sites leading to estimates of current sources generating the measured potentials. It is usually applied to lowfrequency part of the potential (called the Local Field Potential, LFP) and to simultaneous recordings or to recordings taken with fixed time reference to the onset of specific stimulus (Evoked Potentials)’ (Definition by Prof.Daniel K. Wójcik for Encyclopedia of Computational Neuroscience)
CSD is also called as Source Localization or Source Imaging in the EEG circles. Here are CSD methods for different types of electrode configurations.
1D  laminar probe like electrodes. 2D  Microelectrode Array like 3D  UtahArray or multiple laminar probes.
The following methods have been implemented so far
1D  StandardCSD, DeltaiCSD, SplineiCSD, StepiCSD, KCSD1D 2D  KCSD2D, MoIKCSD (Saline layer on top of slice) 3D  KCSD3D
Each of these methods listed have some advantages. The KCSD methods for instance can handle broken or irregular electrode configurations electrode
Keywords: LFP; CSD; Multielectrode; Laminar electrode; Barrel cortex
Citation Policy: See ./current_source_density_src/README.md
Contributors to this current source density estimation module are: Chaitanya Chintaluri(CC), Espen Hagen(EH) and Michał Czerwinski(MC). EH implemented the iCSD methods and StandardCSD CC implemented the kCSD methods, kCSD1D(MC and CC) CC and EH developed the interface to elephant.

elephant.current_source_density.
estimate_csd
(lfp, coords=None, method=None, process_estimate=True, **kwargs)[source]¶ Fuction call to compute the current source density (CSD) from extracellular potential recordings(localfield potentials  LFP) using laminar electrodes or multicontact electrodes with 2D or 3D geometries.
Parameters:  lfp : neo.AnalogSignal
positions of electrodes can be added as neo.RecordingChannel coordinate or sent externally as a func argument (See coords)
 coords : [Optional] corresponding spatial coordinates of the electrodes
Defaults to None Otherwise looks for RecordingChannels coordinate
 method : string
Pick a method corresonding to the setup, in this implementation For Laminar probe style (1D), use ‘KCSD1D’ or ‘StandardCSD’,
or ‘DeltaiCSD’ or ‘StepiCSD’ or ‘SplineiCSD’
For MEA probe style (2D), use ‘KCSD2D’, or ‘MoIKCSD’ For array of laminar probes (3D), use ‘KCSD3D’ Defaults to None
 process_estimate : bool
In the py_iCSD_toolbox this corresponds to the filter_csd  the parameters are passed as kwargs here ie., f_type and f_order In the kcsd methods this corresponds to cross_validate  the parameters are passed as kwargs here ie., lambdas and Rs Defaults to True
 kwargs : parameters to each method
The parameters corresponding to the method chosen See the documentation of the individual method Default is {}  picks the best parameters,
Returns:  Estimated CSD
neo.AnalogSignal object annotated with the spatial coordinates
Raises:  AttributeError
No units specified for electrode spatial coordinates
 ValueError
Invalid function arguments, wrong method name, or mismatching coordinates
 TypeError
Invalid cv_param argument passed

elephant.current_source_density.
generate_lfp
(csd_profile, ele_xx, ele_yy=None, ele_zz=None, xlims=[0.0, 1.0], ylims=[0.0, 1.0], zlims=[0.0, 1.0], res=50)[source]¶ Forward modelling for the getting the potentials for testing CSD
Parameters:  csd_profile : fuction that computes True CSD profile
Available options are (see ./csd/utility_functions.py) 1D : gauss_1d_dipole 2D : large_source_2D and small_source_2D 3D : gauss_3d_dipole
 ele_xx : np.array
Positions of the x coordinates of the electrodes
 ele_yy : np.array
Positions of the y coordinates of the electrodes Defaults ot None, use in 2D or 3D cases only
 ele_zz : np.array
Positions of the z coordinates of the electrodes Defaults ot None, use in 3D case only
 x_lims : [start, end]
The starting spatial coordinate and the ending for integration Defaults to [0.,1.]
 y_lims : [start, end]
The starting spatial coordinate and the ending for integration Defaults to [0.,1.], use only in 2D and 3D case
 z_lims : [start, end]
The starting spatial coordinate and the ending for integration Defaults to [0.,1.], use only in 3D case
 res : int
The resolution of the integration Defaults to 50
Returns:  LFP : neo.AnalogSignal object
The potentials created by the csd profile at the electrode positions The electrode postions are attached as RecordingChannel’s coordinate