Skip to content

Commit

Permalink
clarify tau units in spikes_to_biexp
Browse files Browse the repository at this point in the history
  • Loading branch information
kjohnsen committed Mar 13, 2024
1 parent 42b1f04 commit 71d2426
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "wslfp"
version = "0.1.1"
version = "0.1.2"
description = "Weighted Sum Local Field Potentials - Implementation of the proxy method for point neurons from Mazzoni, Lindén et al., 2015"
authors = [
"Kyle Johnsen <[email protected]>",
Expand Down
16 changes: 9 additions & 7 deletions wslfp/spk2curr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def spikes_to_biexp_currents(
t_spk_ms: np.ndarray,
i_spk: np.ndarray,
J: Union[np.ndarray, sparse.sparray],
tau1: float,
tau2: float,
tau1_ms: float,
tau2_ms: float,
syn_delay_ms: float = 1,
normalize: bool = False,
threshold: float = 0.001,
Expand Down Expand Up @@ -67,15 +67,15 @@ def spikes_to_biexp_currents(
assert t_spk_conv.shape == (T, n_spk)
assert np.all(np.diff(t_spk_ms) >= 0), "assuming t_spk_ms is sorted"

assert tau1 > tau2, "tau1 must be greater than tau2"
assert tau1_ms > tau2_ms, "tau1 must be greater than tau2"

# Define a function for the difference between the biexp_kernel and the threshold
def biexp(t):
return biexp_kernel(t, tau1, tau2, normalize=True) - threshold
return biexp_kernel(t, tau1_ms, tau2_ms, normalize=True) - threshold

# Use fsolve to find the time when the biexp_kernel drops to the threshold
t_end = fsolve(biexp, 6 * tau1)[0]
assert t_end > tau1
t_end = fsolve(biexp, 6 * tau1_ms)[0]
assert t_end > tau1_ms

I_syn = np.zeros((T, n_targets))

Expand All @@ -89,7 +89,9 @@ def biexp(t):
continue
window_sizes[t] = spk_right - spk_left

I_syn_t = biexp_kernel(t_spk_conv[t, spk_left:spk_right], tau1, tau2, normalize)
I_syn_t = biexp_kernel(
t_spk_conv[t, spk_left:spk_right], tau1_ms, tau2_ms, normalize
)

J_t = J[i_spk[spk_left:spk_right], :]
# numpy doesn't handle multiplication with sparse matrices
Expand Down

0 comments on commit 71d2426

Please sign in to comment.