Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if __name__ == '__main__':
print('Checking 1D')
ele_pos = np.array(([-0.1],[0], [0.5], [1.], [1.4], [2.], [2.3]))
pots = np.array([[-1], [-1], [-1], [0], [0], [1], [-1.5]])
k = KCSD1D(ele_pos, pots,
gdx=0.01, n_src_init=300,
ext_x=0.0, src_type='gauss')
k.cross_validate()
print(k.values())
print('Checking 2D')
ele_pos = np.array([[-0.2, -0.2],[0, 0], [0, 1], [1, 0], [1,1], [0.5, 0.5],
[1.2, 1.2]])
pots = np.array([[-1], [-1], [-1], [0], [0], [1], [-1.5]])
k = KCSD2D(ele_pos, pots,
gdx=0.05, gdy=0.05,
xmin=-2.0, xmax=2.0,
ymin=-2.0, ymax=2.0,
src_type='gauss')
k.cross_validate()
print(k.values())
print('Checking MoIKCSD')
k = MoIKCSD(ele_pos, pots,
gdx=0.05, gdy=0.05,
xmin=-2.0, xmax=2.0,
ymin=-2.0, ymax= 2.0)
k.cross_validate()
print('Checking KCSD3D')
ele_pos = np.array([(0, 0, 0), (0, 0, 1), (0, 1, 0), (1, 0, 0),
Defaults to 0.
gdx, gdy : float
space increments in the estimation space
Defaults to 0.01(xmax-xmin)
Defaults to 0.01(ymax-ymin)
lambd : float
regularization parameter for ridge regression
Defaults to 0.
Raises
------
LinAlgError
Could not invert the matrix, try changing the ele_pos slightly
KeyError
Basis function (src_type) not implemented. See basis_functions.py for available
"""
super(KCSD2D, self).__init__(ele_pos, pots, **kwargs)
h : float
thickness of slice
basis_func : method
Fuction of the basis source
Returns
-------
pot : float
"""
y = ((x-xp)**2 + yp**2)**(0.5)
if y < 0.00001:
y = 0.00001
dist = np.sqrt(xp**2 + yp**2)
pot = np.arcsinh(h/y)*basis_func(dist, R)
return pot
class MoIKCSD(KCSD2D):
"""MoIKCSD - CSD while including the forward modeling effects of saline.
This estimates the Current Source Density, for a given configuration of
electrod positions and recorded potentials, in the case of 2D recording
electrodes from an MEA electrode plane using the Method of Images.
The method implented here is based on kCSD method by Jan Potworowski
et.al. 2012, which was extended in Ness, Chintaluri 2015 for MEA.
"""
def __init__(self, ele_pos, pots, **kwargs):
"""Initialize MoIKCSD Class.
Parameters
----------
ele_pos : numpy array
positions of electrodes
pots : numpy array
potentials measured by electrodes