elephant.current_source_density.generate_lfp

elephant.current_source_density.generate_lfp(csd_profile, x_positions, y_positions=None, z_positions=None, x_limits=[0.0, 1.0], y_limits=[0.0, 1.0], z_limits=[0.0, 1.0], resolution=50)[source]

Forward modelling for getting the potentials for testing Current Source Density (CSD).

Parameters:
csd_profilecallable

A function 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

x_positionsnp.ndarray

A 2D column vector (N x 1 array) containing the positions of the x coordinates of the electrodes

y_positionsnp.ndarray, optional

A 2D column vector (N x 1 array) containing the positions of the y coordinates of the electrodes Defaults to None, use in 2D or 3D cases only

z_positionsnp.ndarray, optional

A 2D column vector (N x 1 array) containing the positions of the z coordinates of the electrodes Defaults to None, use in 3D case only

x_limitslist, optional

A list of [start, end]. The starting spatial coordinate and the ending for integration Defaults to [0.,1.]

y_limitslist, optional

A list of [start, end]. The starting spatial coordinate and the ending for integration Defaults to [0.,1.], use only in 2D and 3D case

z_limitslist, optional

A list of [start, end]. The starting spatial coordinate and the ending for integration Defaults to [0.,1.], use only in 3D case

resolutionint, optional

The resolution of the integration Defaults to 50

Returns:
LFPneo.core.AnalogSignal

The potentials created by the csd profile at the electrode positions. The electrode positions are attached as an annotation named ‘coordinates’.

Examples

>>> import numpy as np
>>> from elephant.current_source_density import generate_lfp, estimate_csd
>>> from elephant.current_source_density_src.utility_functions import gauss_1d_dipole  # noqa
>>> # 1. Define an array xs to x coordinate values with a length of 2304
>>> xs=np.linspace(0, 10, 2304)
>>> # 2. Run generate_lfp(gauss_1d_dipole, xs)
>>> lfp = generate_lfp(gauss_1d_dipole, xs)
>>> # 3. Run estimate_csd(lfp, method="StandardCSD")
>>> csd = estimate_csd(lfp, method="StandardCSD")  
discrete ...
>>> # 4. Print the results
>>> print(f"LFPs: {lfp}")
LFPs: [[-0.01483716 -0.01483396 -0.01483075 ...  0.01219233  0.0121911
   0.01218986]] mV
>>> print(f"CSD estimate: {csd}")  
CSD estimate: [[-1.00025592e-04 -6.06684588e-05  ...