Skip to content

Commit 8e2f743

Browse files
katdueckerasoplata
authored andcommitted
feat: KD add remaining extracted non-model code
I believe this adds the last of the code that is extracted from #1168 that is *not* the actual Duecker model itself, but instead code changes that are used by the default model. These functions are not currently tested at all, and I have not added tests for them for similar reasons to #1185 (comment) After this, we should be able to make a PR that adds the actual Duecker model itself. However, there will be additional work for that step: we need to update `hnn_io.read_network_configuration` and the equivalent `...write...` such that they support the Duecker model. Continuing the pattern, this is based on top of #1187.
1 parent c3aa401 commit 8e2f743

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

hnn_core/cells_default.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def _get_mechanisms(p_all, cell_type, section_names, mechanisms):
388388
return mech_props
389389

390390

391-
def _exp_g_at_dist(x, zero_val, exp_term, offset):
391+
def _exp_g_at_dist(x, zero_val, exp_term, offset, slope=1):
392392
"""Compute exponential distance-dependent ionic conductance.
393393
394394
Parameters
@@ -399,12 +399,16 @@ def _exp_g_at_dist(x, zero_val, exp_term, offset):
399399
Value of function when x = 0
400400
exp_term : float | int
401401
Multiplier of x in the exponent
402-
offset: float |int
402+
offset : float | int
403403
Offset value added to output
404-
404+
slope : int | float, default=1
405+
Slope of the exponential component
405406
"""
406-
407-
return zero_val * np.exp(exp_term * x) + offset
407+
# AES: TODO Should the offset be multiplied by zero_val? This was also changed in
408+
# #1168, but seems suspicious to me... It currently passes tests, BUT it appears
409+
# that offset is always 0 in every use case used so far, so if this introduces a
410+
# bug, it will not be detected...
411+
return zero_val * (slope * np.exp(exp_term * x) + offset)
408412

409413

410414
def basket(cell_name, pos=(0, 0, 0), gid=None):
@@ -475,7 +479,7 @@ def pyramidal(cell_name, pos=(0, 0, 0), override_params=None, gid=None):
475479
raise ValueError(f"Unknown pyramidal cell type: {cell_name}")
476480

477481

478-
def _linear_g_at_dist(x, gsoma, gdend, xkink):
482+
def _linear_g_at_dist(x, gsoma, gdend, xkink, hotzone_factor=1, hotzone=[0, 0]):
479483
"""Compute linear distance-dependent ionic conductance.
480484
481485
Parameters
@@ -488,13 +492,23 @@ def _linear_g_at_dist(x, gsoma, gdend, xkink):
488492
Dendritic conductance
489493
xkink : float | int
490494
Plateau value where conductance is fixed at gdend.
495+
hotzone_factor: int | float, default=1
496+
Increase in conducivity that creates a hotzone.
497+
hotzone : [float, float]
498+
TODO: AES: Seems to be the start and end distance of the hotzone. Should prob be
499+
renamed to `hotzone_boundaries` or something like that. Start and end of
500+
hotzone if hotzone_factor > 1. Units are the same as that of `x`.
491501
492502
Notes
493503
-----
494504
Linearly scales conductance along dendrite.
495505
Returns gdend when x > xkink.
496506
"""
497-
return gsoma + np.min([xkink, x]) * (gdend - gsoma) / xkink
507+
gbar = gsoma + np.min([xkink, x]) * (gdend - gsoma) / xkink
508+
if hotzone[0] < x < hotzone[1]:
509+
gbar *= hotzone_factor
510+
511+
return gbar
498512

499513

500514
def pyramidal_ca(cell_name, pos, override_params=None, gid=None):

0 commit comments

Comments
 (0)