Skip to content

Commit

Permalink
Cleanup and minor doc-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
torbjone committed May 15, 2023
1 parent 719d0af commit 181188c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
27 changes: 10 additions & 17 deletions lfpykernels/kernel_approximator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def integrate_beta(tau_1, tau_2):


class KernelApprox(object):
'''Class for computing linear spike-to-signal filter kernels resulting
"""Class for computing linear spike-to-signal filter kernels resulting
from presynaptic spiking activity and resulting postsynaptic currents
Parameters
Expand Down Expand Up @@ -102,7 +102,7 @@ class KernelApprox(object):
conductance_based: bool
``True`` (default) if the original network model has conductance-based
synapses, ``False`` if it uses current-based synapses
'''
"""

def __init__(
self,
Expand Down Expand Up @@ -155,7 +155,7 @@ def __init__(
self.conductance_based = conductance_based

def get_delay(self, X, dt, tau):
'''Get normalized transfer function for conduction delay distribution
"""Get normalized transfer function for conduction delay distribution
for connections between population X and Y
Parameters
Expand All @@ -172,7 +172,7 @@ def get_delay(self, X, dt, tau):
h_delta: ndarray
shape (2 * tau // dt + 1) array with transfer function for delay
distribution
'''
"""
t = np.linspace(-tau, tau, int(2 * tau // dt + 1))
[i] = np.where(np.array(self.X) == X)[0]
h_delay = self.delayFunction(**self.delayParameters[i]).pdf(t)
Expand Down Expand Up @@ -352,7 +352,7 @@ def _get_multapsedist(self, i):
def get_kernel(self, probes, Vrest=-65, dt=2**-4,
X='E', t_X=200, tau=50,
g_eff=True, fir=False):
'''Compute linear spike-to-signal filter kernel mapping presynaptic
"""Compute linear spike-to-signal filter kernel mapping presynaptic
population firing rates/spike trains to signal measurement, e.g., LFP.
Parameters
Expand Down Expand Up @@ -391,7 +391,7 @@ def get_kernel(self, probes, Vrest=-65, dt=2**-4,
-------
H_YX: dict of ndarray
shape (n_channels, 2 * tau // dt + 1) linear response kernel
'''
"""

mssg = "g_eff is True but conductance_based is False." + \
"This probably makes no sense...?"
Expand Down Expand Up @@ -437,9 +437,6 @@ def get_kernel(self, probes, Vrest=-65, dt=2**-4,
self.cell = cell # saving cell for debugging and plotting
# set cell rotation
cell.set_rotation(**self.rotationParameters)
# TODO: I COULD FIND NOWHERE THE CELL IS MOVED TO ITS LOCATION??
# TODO: CHECK IF THIS MAKES SENSE!!
cell.set_pos(z=self.populationParameters['loc'])

# set cell position
cell.set_pos(z=self.populationParameters['loc'])
Expand Down Expand Up @@ -500,11 +497,7 @@ def get_kernel(self, probes, Vrest=-65, dt=2**-4,
# somatic depth, which may be implemented as:
# syn_pos['funargs'][h]['loc'] = \
# funarg['loc'] + self.populationParameters['loc']
# TODO: Any reason why we can't just implement
# this as a standard
# TODO: convolution, to get rid of the
# requirement that both soma and
# TODO: synapse positions should be gaussian?

syn_pos['funargs'][h]['scale'] = \
np.sqrt(funarg['scale']**2 +
self.populationParameters['scale']**2)
Expand Down Expand Up @@ -685,7 +678,7 @@ def _func(self, z, z_e=0, z_i=0):
return self._f(z_e - z, z_i) * self._g(z)

def get_transformation_matrix(self):
'''
"""
Get linear response matrix
Returns
Expand All @@ -697,7 +690,7 @@ def get_transformation_matrix(self):
------
AttributeError
if ``cell is None``
'''
"""
if self.cell is None:
raise AttributeError(
'{}.cell is None'.format(self.__class__.__name__))
Expand All @@ -714,7 +707,7 @@ def get_transformation_matrix(self):

class KernelApproxCurrentDipoleMoment(lfpykit.CurrentDipoleMoment):
"""Modified ``lfpykit.CurrentDipoleMoment`` like class that ignores
contributions to the current dipole moment in the the x- and y-directions
contributions to the current dipole moment in the x- and y-directions
due to rotational symmetry around the z-axis.
Parameters
Expand Down
4 changes: 2 additions & 2 deletions lfpykernels/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_KernelApprox_00(self):
custom_fun=[set_passive],
custom_fun_args=[{'Vrest': Vrest}],
templateargs=None,
delete_sections=False,
delete_sections=True,
morphology=os.path.join(lfpykernels.__path__[0], 'tests',
'BallAndSticks_E.hoc')
)
Expand Down Expand Up @@ -234,7 +234,7 @@ def test_KernelApprox_01(self):
custom_fun=[set_passive],
custom_fun_args=[{'Vrest': Vrest}],
templateargs=None,
delete_sections=False,
delete_sections=True,
morphology=os.path.join(lfpykernels.__path__[0], 'tests',
'BallAndSticks_E.hoc')
)
Expand Down

0 comments on commit 181188c

Please sign in to comment.