Saved searches

Use saved searches to filter your results more quickly

Cancel Create saved search Sign up Reseting focus

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail to play a vector to iclamp in for loop #81

YY535 opened this issue Jul 18, 2018 · 1 comment

fail to play a vector to iclamp in for loop #81

YY535 opened this issue Jul 18, 2018 · 1 comment

Comments

YY535 commented Jul 18, 2018

Hi,
I've got some issue when simulating in the python-neuron environment, where I want to inject currents with arbitrary time serials into multiple locations. If I'm setting the current clamps in a for loop, only the last stimulation would work. On the other hand, it also doesn't work when I try to define a current injection in a function (see the inject_curr below). Can anyone point out what's the problem?
Following is an example code:

from neuron import * from nrn import * import matplotlib.pyplot as plt import numpy as np h.t = 0. tstop = 10**2. h.dt = 2**-4. axon = Section() axon.L = 3000 axon.nseg = 3000 axon.insert('hh') axon.insert('pas') VecAxon = h.Vector() VecAxon.record(axon(0.1)._ref_v) stimlist = h.List() veclist = h.List() def inject_curr(sec, curr_loc, t): VecT = h.Vector(t) VecStim = h.Vector(10*np.sin(t/5)) stim = h.IClamp(sec(curr_loc)) stim.dur = 1e9 stim.delay = 0 VecStim.play(stim._ref_amp, VecT) stimlist.append(stim) veclist.append(VecStim) return VecStim, sec time = h.Vector() time.record(h._ref_t) tt = np.linspace(h.t, tstop, np.fix((-h.t+tstop)/h.dt +1)) VecStim1, axon = inject_curr(axon, .5, tt) for i in range(5): t = h.Vector(np.array([i*20, i*20+5])) VecStim = h.Vector([100, -20]) loc = .1+i*.1 stim = h.IClamp(axon(loc)) stim.dur = 1e9 stim.delay = 0 VecStim.play(stim._ref_amp, t) stimlist.append(stim) veclist.append(VecStim) h.finitialize(-68) run(tstop) plt.figure() plt.plot(tt,VecAxon) plt.plot(tt,(np.array(VecStim1)/50 -68.)) plt.show() 

The text was updated successfully, but these errors were encountered: