Null pointer error when trying to access the pointer through python
Posted: Sun Mar 26, 2023 6:06 am
Hello,
I have four neurons in my network defined through cell templates in hoc - dopa, gaba, chol, and glu. I have multiple mod files for different receptors as well. Now I want to create a synapse between two neurons through python.
I am using this code for the gaba A type receptor:
Now, I want to add this receptor onto the dopa soma surface and want the pointer to point to the transmitter concentration releasing through the gaba's 68th axon in python. When I am using this code, it is giving me a null pointer here:
C:\Users\verma\OneDrive\Automated_model>python 1synaptic_py.py
1
1
1
1
1
Traceback (most recent call last):
File "C:\Users\verma\OneDrive\Automated_model\1synaptic_py.py", line 43, in <module>
r.C = gaba.axon[68].T_rel
AttributeError: POINTER is NULL
How can I do this right? I am not getting any of this error when I am trying to do it in hoc like this:
I have four neurons in my network defined through cell templates in hoc - dopa, gaba, chol, and glu. I have multiple mod files for different receptors as well. Now I want to create a synapse between two neurons through python.
I am using this code for the gaba A type receptor:
Here, C is a pointer which is accessing the transmitter concentration from the release mechanism as defined here: https://senselab.med.yale.edu/ModelDB/S ... mod#tabs-2NEURON {
POINT_PROCESS gabaa
USEION cl READ ecl WRITE icl VALENCE -1
NONSPECIFIC_CURRENT ihco3
POINTER C
RANGE C0, C1, C2, D1, D2, O1,O2, curr, hco3i, hco3o
RANGE g, gmax, rb1, rb2, q0, tr, del, tdur
GLOBAL Erev
GLOBAL Rb1, Rb2, Ru1, Ru2, Rd1, Rd2, Rr1, Rr2, a1, b1, a2, b2, p, q
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(umho) = (micromho)
(mM) = (milli/liter)
(uM) = (micro/liter)
(mA) = (milliamp)
F = (faraday) (coulomb)
R = (mole k) (mV-coulomb/degC)
}
PARAMETER {
celsius = 37 (degC)
Erev = -80 (mV) : reversal potential
hco3i = 16 (mM)
hco3o = 26 (mM)
gmax = 28 (pS) : maximal conductance
tdur = 5 (ms)
del = 0 (ms)
Pr = 0.3
dmax = 3.6 (/ms)
kh = 2 (mM)
nh = 2
: Rates
rb1 = 30 (/mM /ms)
Ru1 = 90e-03 (/ms)
rb2 = 15 (/mM /ms)
Ru2 = 180e-03 (/ms)
b1 = 0.2 (/ms)
a1 = 1.1 (/ms)
b2 = 2.5 (/ms)
a2 = 0.142 (/ms)
Rd1 = 0.006 (/ms)
Rr1 = 0.35e-03 (/ms)
Rr2 = 0.05 (/ms)
p = 0.001 (/ms)
q0 = 1e-08 (/mM /ms)
}
ASSIGNED {
v (mV) : postsynaptic voltage
curr (nA) : current = g*(v - Erev)
g (pS) : conductance
tr (mM)
ecl (mV)
ehco3 (mV)
Rb1 (/ms)
Rb2 (/ms)
Rd2 (/ms)
q (/ms)
icl (nA)
C (mM)
ihco3 (nA)
}
STATE {
C0 : unbound
C1 : single GABA bound
C2 : double GABA bound
O1 : Open state from single bound state
O2 : Open state from single bound state
D1 : single GABA bound, desensitized
D2 : double GABA bound, desensitized
}
INITIAL {
C0 = 1
C1 = 0
C2 = 0
O1 = 0
O2 = 0
D1 = 0
D2 = 0
tr = 0
}
BREAKPOINT {
SOLVE kstates METHOD sparse
ehco3 = log(hco3i/hco3o)*(celsius + 273.15)*R/F
g = gmax * (O1 + O2)
curr = (1e-6) * g * (v - Erev)
ihco3 = Pr*curr
icl = (1-Pr)*curr
}
KINETIC kstates {
release()
Rb1 = rb1 * tr
Rb2 = rb2 * tr
Rd2 = dmax/( 1 + (kh/tr)^nh)
q = q0 * tr
~ C0 <-> C1 (Rb1, Ru1)
~ C1 <-> C2 (Rb2, Ru2)
~ C1 <-> O1 (b1, a1)
~ C2 <-> O2 (b2, a2)
~ O1 <-> D1 (Rd1, Rr1)
~ O2 <-> D2 (Rd2, Rr2)
~ D1 <-> D2 (q, p)
CONSERVE C0+C1+C2+D1+D2+O1+O2 = 1
}
FUNCTION release(){
at_time(del)
at_time(del+tdur)
if (t>del && t<=(del+tdur)) {
tr = C
}
else{ tr = 0}
}
Now, I want to add this receptor onto the dopa soma surface and want the pointer to point to the transmitter concentration releasing through the gaba's 68th axon in python. When I am using this code, it is giving me a null pointer here:
Its giving this error:post1 = []
num_receptors = 1000
for i in range(num_receptors):
r = h.gabaa()
r.loc(0.5, sec=dopa.soma)
r.C = gaba.axon[68].T_rel
post1.append(r)
C:\Users\verma\OneDrive\Automated_model>python 1synaptic_py.py
1
1
1
1
1
Traceback (most recent call last):
File "C:\Users\verma\OneDrive\Automated_model\1synaptic_py.py", line 43, in <module>
r.C = gaba.axon[68].T_rel
AttributeError: POINTER is NULL
How can I do this right? I am not getting any of this error when I am trying to do it in hoc like this:
objectvar post1[1000]
for r = 0, 999{
post1[r] = new gabaa()
dopa.soma post1[r].loc(0.5)
setpointer post1[r].C, gaba.axon[68].T_rel
}