Skip to content

Commit b8953da

Browse files
katdueckerasoplata
authored andcommitted
kd: apply cells_default.py changes [no ci]
This does NOT pass tests The original person who actually wrote this code was @katduecker, which is why they are indicated as author. This version of the code that was extracted from jonescompneurolab#1168 was done so by @asoplata .
1 parent 8070bce commit b8953da

File tree

1 file changed

+82
-6
lines changed

1 file changed

+82
-6
lines changed

hnn_core/cells_default.py

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# units for taur: ms
1616

1717

18-
def _get_dends(params, cell_type, section_names):
18+
# KD: comment: initialize membrane potential here as it's not overridden by
19+
# h.finitialize unless called as h.finitialize(-65)
20+
def _get_dends(params, cell_type, section_names, v_init={"all": -65}):
1921
"""Convert a flat dictionary to a nested dictionary.
2022
2123
Returns
@@ -34,22 +36,64 @@ def _get_dends(params, cell_type, section_names):
3436
# map apicaltrunk -> apical_trunk etc.
3537
middle = section_name.replace("_", "")
3638
dend_prop[key] = params[f"{cell_type}_{middle}_{key}"]
39+
if len(v_init) == 1:
40+
v = v_init["all"]
41+
else:
42+
v = v_init[section_name]
43+
3744
sections[section_name] = Section(
3845
L=dend_prop["L"],
3946
diam=dend_prop["diam"],
4047
Ra=dend_prop["Ra"],
4148
cm=dend_prop["cm"],
49+
v=v,
4250
)
4351
return sections
4452

4553

46-
def _get_pyr_soma(p_all, cell_type):
54+
# KD: In the new model, the basal dendrites are differently tuned from the apical
55+
# dendrites.
56+
def _get_basal(params, cell_type, section_names, v_init={"all": -65}):
57+
"""Convert a flat dictionary to a nested dictionary.
58+
59+
Returns
60+
-------
61+
sections : dict
62+
Dictionary of sections. Keys are section names
63+
"""
64+
prop_names = ["L", "diam", "Ra", "cm"]
65+
sections = dict()
66+
for section_name in section_names:
67+
dend_prop = dict()
68+
middle = section_name.replace("_", "")
69+
for key in prop_names:
70+
if key in ["Ra", "cm"]:
71+
middle = "basal"
72+
else:
73+
# map apicaltrunk -> apical_trunk etc.
74+
middle = section_name.replace("_", "")
75+
dend_prop[key] = params[f"{cell_type}_{middle}_{key}"]
76+
if len(v_init) == 1:
77+
v = v_init["all"]
78+
else:
79+
v = v_init[section_name]
80+
sections[section_name] = Section(
81+
L=dend_prop["L"],
82+
diam=dend_prop["diam"],
83+
Ra=dend_prop["Ra"],
84+
cm=dend_prop["cm"],
85+
v=v,
86+
)
87+
88+
89+
def _get_pyr_soma(p_all, cell_type, v_init=-65):
4790
"""Get somatic properties."""
4891
return Section(
4992
L=p_all[f"{cell_type}_soma_L"],
5093
diam=p_all[f"{cell_type}_soma_diam"],
5194
cm=p_all[f"{cell_type}_soma_cm"],
5295
Ra=p_all[f"{cell_type}_soma_Ra"],
96+
v=v_init,
5397
)
5498

5599

@@ -70,7 +114,12 @@ def _cell_L2Pyr(override_params, pos=(0.0, 0.0, 0), gid=0.0):
70114
"basal_3",
71115
]
72116

73-
sections = _get_dends(p_all, cell_type="L2Pyr", section_names=section_names)
117+
sections = _get_dends(
118+
p_all,
119+
cell_type="L2Pyr",
120+
section_names=section_names,
121+
v_init={"all": -71.46},
122+
)
74123
sections["soma"] = _get_pyr_soma(p_all, "L2Pyr")
75124

76125
end_pts = {
@@ -153,8 +202,29 @@ def _cell_L5Pyr(override_params, pos=(0.0, 0.0, 0), gid=0.0):
153202
"basal_3",
154203
]
155204

156-
sections = _get_dends(p_all, cell_type="L5Pyr", section_names=section_names)
157-
sections["soma"] = _get_pyr_soma(p_all, "L5Pyr")
205+
v_init = {
206+
"apical_1": -71.32,
207+
"apical_2": -69.08,
208+
"apical_tuft": -67.30,
209+
"apical_trunk": -72,
210+
"soma": -72.0,
211+
"basal_1": -72,
212+
"basal_2": -72,
213+
"basal_3": -72,
214+
"apical_oblique": -72,
215+
}
216+
217+
sections = _get_dends(
218+
p_all,
219+
cell_type="L5Pyr",
220+
section_names=section_names,
221+
v_init=v_init,
222+
)
223+
sections["soma"] = _get_pyr_soma(
224+
p_all,
225+
"L5Pyr",
226+
v_init=-72,
227+
)
158228

159229
end_pts = {
160230
"soma": [[0, 0, 0], [0, 0, 23]],
@@ -230,11 +300,17 @@ def _cell_L5Pyr(override_params, pos=(0.0, 0.0, 0), gid=0.0):
230300
)
231301

232302

233-
def _get_basket_soma(cell_name):
303+
def _get_basket_soma(cell_name, v_init=-64.9737):
234304
end_pts = [[0, 0, 0], [0, 0, 39.0]]
235305
return Section(L=39.0, diam=20.0, cm=0.85, Ra=200.0, end_pts=end_pts)
236306

237307

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)
312+
313+
238314
def _get_pyr_syn_props(p_all, cell_type):
239315
return {
240316
"ampa": {

0 commit comments

Comments
 (0)