Trouble using play method on Python with complex cells

When Python is the interpreter, what is a good
design for the interface to the basic NEURON

Moderator: hines

Post Reply
Posts: 5
Joined: Fri May 20, 2022 8:07 am

Trouble using play method on Python with complex cells

Post by gabrielggn »


I am working on extracellular stimulation and I'm currently coding it with realistic shape using swc existing models.
To do so, I'm using the files coded for the "xtra" mechanism to input scalars values of potentials via rx and I want to set the time course using "is_xtra" via a defined signal in python (using Vector(array)). the rx assignement work but setting the time course using ",t, 1) " does not work. So I tryied on simpler models to drive a variable with the play methode and for Ball & sticl model, the play method is working to drive "e_extracellular" as well as "v".

However for both neurolucida3 and swc files it does not work either for the "v" variable or "e_extracellular". Do you have any clue why ?

Here are parts of my code :
to import the cell and set the biophy

Code: Select all

h.celsius = 37

list_morpho = ["c91662.swc","h549379618.swc", "h591274508.swc", "C280199C.swc", "cell1.asc"]
morpho = list_morpho[4]
if morpho[-3:] == "swc":
    cell = h.Import3d_SWC_read()
elif morpho[-3:] == "asc":
    cell = h.Import3d_Neurolucida3()
    error("extension not recognized")
i3d = h.Import3d_GUI(cell, False)

freq, d_lam = 100, 0.1
for sec in h.allsec():
    sec.nseg = math.ceil( (sec.L/(d_lam * h.lambda_f(freq) ))/2.0 )*2 +1 
    sec.Ra = 155.0 # Ohm cm-1
    for seg in sec:
            seg.pas.g =1.0/(70*1e3) # Rm = 70 kOhm.cm2

to run the simulation

Code: Select all

h.v_init = -70*mV
h.tstop = 199 #ms

times =np.arange(0,h.tstop+h.dt,h.dt)
sig=200*np.sin(2*np.pi*10/1000.0*times) # 10Hz sinus
t = h.Vector().from_python(times)
stim = h.Vector().from_python(sig)[0](0.5).v), t)
t = h.Vector().record(h._ref_t)
v = h.Vector().record(h.soma[0](0.5)._ref_v)

ve = h.Vector().record(h.dend[0](0.5)._ref_v)

plt.plot(t, ve)

Of course the plot is zero all the long and the play method does not seem to do anything..
Post Reply