Skip to content

Commit 5be1ed2

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 jonescompneurolab#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 jonescompneurolab#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 jonescompneurolab#1187.
1 parent 90f4d63 commit 5be1ed2

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
@@ -303,7 +303,7 @@ def _get_mechanisms(p_all, cell_type, section_names, mechanisms):
303303
return mech_props
304304

305305

306-
def _exp_g_at_dist(x, zero_val, exp_term, offset):
306+
def _exp_g_at_dist(x, zero_val, exp_term, offset, slope=1):
307307
"""Compute exponential distance-dependent ionic conductance.
308308
309309
Parameters
@@ -314,12 +314,16 @@ def _exp_g_at_dist(x, zero_val, exp_term, offset):
314314
Value of function when x = 0
315315
exp_term : float | int
316316
Multiplier of x in the exponent
317-
offset: float |int
317+
offset : float | int
318318
Offset value added to output
319-
319+
slope : int | float, default=1
320+
Slope of the exponential component
320321
"""
321-
322-
return zero_val * np.exp(exp_term * x) + offset
322+
# AES: TODO Should the offset be multiplied by zero_val? This was also changed in
323+
# #1168, but seems suspicious to me... It currently passes tests, BUT it appears
324+
# that offset is always 0 in every use case used so far, so if this introduces a
325+
# bug, it will not be detected...
326+
return zero_val * (slope * np.exp(exp_term * x) + offset)
323327

324328

325329
def basket(cell_name, pos=(0, 0, 0), gid=None):
@@ -390,7 +394,7 @@ def pyramidal(cell_name, pos=(0, 0, 0), override_params=None, gid=None):
390394
raise ValueError(f"Unknown pyramidal cell type: {cell_name}")
391395

392396

393-
def _linear_g_at_dist(x, gsoma, gdend, xkink):
397+
def _linear_g_at_dist(x, gsoma, gdend, xkink, hotzone_factor=1, hotzone=[0, 0]):
394398
"""Compute linear distance-dependent ionic conductance.
395399
396400
Parameters
@@ -403,13 +407,23 @@ def _linear_g_at_dist(x, gsoma, gdend, xkink):
403407
Dendritic conductance
404408
xkink : float | int
405409
Plateau value where conductance is fixed at gdend.
410+
hotzone_factor: int | float, default=1
411+
Increase in conducivity that creates a hotzone.
412+
hotzone : [float, float]
413+
TODO: AES: Seems to be the start and end distance of the hotzone. Should prob be
414+
renamed to `hotzone_boundaries` or something like that. Start and end of
415+
hotzone if hotzone_factor > 1. Units are the same as that of `x`.
406416
407417
Notes
408418
-----
409419
Linearly scales conductance along dendrite.
410420
Returns gdend when x > xkink.
411421
"""
412-
return gsoma + np.min([xkink, x]) * (gdend - gsoma) / xkink
422+
gbar = gsoma + np.min([xkink, x]) * (gdend - gsoma) / xkink
423+
if hotzone[0] < x < hotzone[1]:
424+
gbar *= hotzone_factor
425+
426+
return gbar
413427

414428

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

0 commit comments

Comments
 (0)