I want to construct a network of pyramdial cells and interneuron. Therefore I have chosen to use a cell template similar to this one https://senselab.med.yale.edu/modeldb/S ... del=222321. Right now I am trying to construct cell templates in python that are similar to the original ones but use the same mechanisms. However I am having trouble including the mechanisms for the Na-K pump nakpump.mod. This mechanism needs a stability function that recaclulates sodium and potassium conductances and the maximal flux of the pump. This is done by defining simultaneous equations. The function is called once before the simulation is run. Here is the code of the original implementation in hoc:

Code: Select all

```
proc pyramstab() {
access psoma
rm=$1
init()
vrest = -70
dr_na = vrest-ena
dr_k = vrest-ek
eqinit()
depvar gna, gk
eqn gk:: gk = 1/rm - gna
eqn gna:: gna = (-dr_k*(3/2)*gk)/dr_na
solve()
forall gk_leak=gk
forall gna_leak=gna
p_k=(1+km_k_nakpump/ko)^(-2)
p_na=(1+km_na_nakpump/nai)^(-3)
p_tot=p_k*p_na
forall imax_nakpump = (-gna_leak*dr_na)/(3*p_tot)
}
```

Code: Select all

```
def stab(celllist):
rm=5e3
vrest = -70
for nn in range(len(celllist)): # for each cell calculate and assign gk_leak, gna_leak and imax_nakpump
dr_na = vrest-celllist[nn].soma.ena
dr_k = vrest-celllist[nn].soma.ek
gk=(2*dr_na)/((3*dr_k-2*dr_na)*rm) # equations solved for gk and gna, see EqnSolve.nb
gna=(3*dr_k)/((3*dr_k-2*dr_na)*rm)
for ss in celllist[nn].sections:
ss.gk_leak=gk
ss.gna_leak=gna
p_k=(1+celllist[nn].soma.km_k_nakpump/celllist[nn].soma.ko)**(-2)
p_na=(1+celllist[nn].soma.km_na_nakpump/celllist[nn].soma.nai)**(-3)
p_tot=p_k*p_na
for ss in celllist[nn].sections:
ss.imax_nakpump = (-ss.gna_leak*dr_na)/(3*p_tot)
return
```

I would appreciate any help!

Best, Cathi