Skip to content

Commit 80863e1

Browse files
committed
fix: add missing L2 soma v_init, remove old init
This fixes what I think is a bug currently present in jonescompneurolab#1168, where the L2's `soma` section did not have its universal voltage-initialization value applied (but the dendrites did). Additionally, @katduecker , I think the same bug is present in your `_get_interneuron_soma()` function (which I've removed in this commit since it's not relevant to the voltage-initialization). Your `_get_interneuron_soma` takes a `v_init` value, but does not apply it in `Section` creation. This was probably missed. This also removes `NetworkBuilder.state_init()` like KD did, since it is no longer needed, as the voltage initialization is completely moved over to `cells_default.py` now. With this, I think the voltage-initialization stuff has been completely extracted from jonescompneurolab#1168. The only remaining work is to write new tests specifically for the `v_init` where it is used.
1 parent 43c77c1 commit 80863e1

File tree

4 files changed

+24
-48
lines changed

4 files changed

+24
-48
lines changed

hnn_core/cells_default.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ def _cell_L2Pyr(override_params, pos=(0.0, 0.0, 0), gid=0.0):
104104
assert isinstance(override_params, dict)
105105
p_all = compare_dictionaries(p_all, override_params)
106106

107+
all_v_init = -71.46
108+
107109
section_names = [
108110
"apical_trunk",
109111
"apical_1",
@@ -118,9 +120,15 @@ def _cell_L2Pyr(override_params, pos=(0.0, 0.0, 0), gid=0.0):
118120
p_all,
119121
cell_type="L2Pyr",
120122
section_names=section_names,
121-
v_init={"all": -71.46},
123+
v_init={
124+
"all": all_v_init,
125+
},
126+
)
127+
sections["soma"] = _get_pyr_soma(
128+
p_all,
129+
"L2Pyr",
130+
v_init=all_v_init,
122131
)
123-
sections["soma"] = _get_pyr_soma(p_all, "L2Pyr")
124132

125133
end_pts = {
126134
"soma": [[-50, 0, 765], [-50, 0, 778]],
@@ -302,13 +310,14 @@ def _cell_L5Pyr(override_params, pos=(0.0, 0.0, 0), gid=0.0):
302310

303311
def _get_basket_soma(cell_name, v_init=-64.9737):
304312
end_pts = [[0, 0, 0], [0, 0, 39.0]]
305-
return Section(L=39.0, diam=20.0, cm=0.85, Ra=200.0, end_pts=end_pts)
306-
307-
308-
# values from Chamberland et al 2023
309-
def _get_interneuron_soma(cell_name, v_init=-75):
310-
end_pts = [[0, 0, 0], [0, 0, 20.0]]
311-
return Section(L=20.0, diam=20.0, cm=1, Ra=200.0, end_pts=end_pts)
313+
return Section(
314+
L=39.0,
315+
diam=20.0,
316+
cm=0.85,
317+
Ra=200.0,
318+
v=v_init,
319+
end_pts=end_pts,
320+
)
312321

313322

314323
def _get_pyr_syn_props(p_all, cell_type):

hnn_core/network_builder.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ def _build(self):
371371
record_ca=record_ca,
372372
)
373373

374-
self.state_init()
375-
376374
# set to record spikes, somatic voltages, and extracellular potentials
377375
self._spike_times = h.Vector()
378376
self._spike_gids = h.Vector()
@@ -649,37 +647,6 @@ def aggregate_data(self, n_samples):
649647

650648
_PC.barrier() # get all nodes to this place before continuing
651649

652-
def state_init(self):
653-
"""Initializes the state closer to baseline."""
654-
655-
for cell in self._cells:
656-
seclist = h.SectionList()
657-
seclist.wholetree(sec=cell._nrn_sections["soma"])
658-
src_type = self.net.gid_to_type(cell.gid)
659-
cell_metadata = self.net.cell_types[src_type]["cell_metadata"]
660-
# initializing segment voltages from cell_metadata
661-
for sect in seclist:
662-
for seg in sect:
663-
if (
664-
cell_metadata.get("morpho_type") == "pyramidal"
665-
and cell_metadata.get("layer") == "2"
666-
):
667-
seg.v = -71.46
668-
elif (
669-
cell_metadata.get("morpho_type") == "pyramidal"
670-
and cell_metadata.get("layer") == "5"
671-
):
672-
if sect.name() == f"{_short_name(src_type)}_apical_1":
673-
seg.v = -71.32
674-
elif sect.name() == f"{_short_name(src_type)}_apical_2":
675-
seg.v = -69.08
676-
elif sect.name() == f"{_short_name(src_type)}_apical_tuft":
677-
seg.v = -67.30
678-
else:
679-
seg.v = -72.0
680-
elif cell_metadata.get("morpho_type") == "basket":
681-
seg.v = -64.9737
682-
683650
def _clear_neuron_objects(self):
684651
"""Clear up NEURON internal gid and reference information.
685652

hnn_core/param/jones2009_base.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
]
3333
],
3434
"nseg": 1,
35-
"v": -65,
35+
"v": -64.9737,
3636
"mechs": {
3737
"hh2": {}
3838
},
@@ -370,7 +370,7 @@
370370
]
371371
],
372372
"nseg": 1,
373-
"v": -65,
373+
"v": -71.46,
374374
"mechs": {
375375
"km": {
376376
"gbar_km": 250.0
@@ -503,7 +503,7 @@
503503
]
504504
],
505505
"nseg": 1,
506-
"v": -65,
506+
"v": -64.9737,
507507
"mechs": {
508508
"hh2": {}
509509
},

hnn_core/tests/assets/jones2009_3x3_drives.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
]
3333
],
3434
"nseg": 1,
35-
"v": -65,
35+
"v": -64.9737,
3636
"mechs": {
3737
"hh2": {}
3838
},
@@ -370,7 +370,7 @@
370370
]
371371
],
372372
"nseg": 1,
373-
"v": -65,
373+
"v": -71.46,
374374
"mechs": {
375375
"km": {
376376
"gbar_km": 250.0
@@ -503,7 +503,7 @@
503503
]
504504
],
505505
"nseg": 1,
506-
"v": -65,
506+
"v": -64.9737,
507507
"mechs": {
508508
"hh2": {}
509509
},

0 commit comments

Comments
 (0)