recording delivered pulses using pulsedistrib.zip

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

Moderator: hines

Post Reply
alexandrapierri
Posts: 69
Joined: Wed Jun 17, 2015 5:31 pm

recording delivered pulses using pulsedistrib.zip

Post by alexandrapierri »

Hello

I am using pulsedistrib.zip, to deliver a set of 10 pulses of 1ms approx per pulse.
I am having difficulty controlling the Ipulse2 parameters either from my python script or directly from within the mod file.
For example, the following syntax doesn't work:

iclamp = h.Ipulse2(bs.soma(0.5)) #where bs is my basket cell
iclamp.dur = 0.01
iclamp.num=10
iclamp.per=0.1

Questions:
1. what is the right syntax to control Ipulse2 params?
2. how can I record the delivered pulses (i.e the iclamp._ref_i or something analogous)
3. why are there two values for params such as dur and per in the Ipulse2 mod file? I was expecting to see single values, not sure what i.e the interval <0, 1e9> represents.

thank you,
Alexandra
ted
Site Admin
Posts: 6286
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: recording delivered pulses using pulsedistrib.zip

Post by ted »

Good questions. Before addressing them, I should mention that
1. you're asking about mechanisms that deliver a series of one or more current pulses at regular intervals
2. the source code for these mechanisms is in https://www.neuron.yale.edu/ftp/ted/neu ... istrib.zip
3. these mechanisms differ in terms of how one specifies the parameters that govern the pulses. Ipulse1 needs ton (duration of current pulse) and toff (interpulse interval), while Ipulse2 needs dur (same as Ipulse1's ton) and per (the period of the stimlus train, which is the same as Ipulse1's ton+toff). Ipulse3 is triggered by an event from a NetCon, and delivers single current pulse of user-specified amplitude and duration; events that arrive during an ongoing pulse are ignored.
4. the parameter "del" will automatically be known to Python as "delay" (because del is a reserved word in Python). Example:
pulser = h.Ipulse2(soma(0.5))
pulser.delay = 5 # first pulse will start at h.t = 5 ms

Now for your questions.

Code: Select all

iclamp.dur = 0.01
And what is the value of h.dt? Hint: for fixed step methods, duration must be at least as long as h.dt. That probably takes care of your problem.
how can I record the delivered pulses (i.e the iclamp._ref_i or something analogous)
Sounds reasonable. Does it work?
<0, 1e9>
That's a hint to NEURON's GUI. It prevents users from using a GUI tool (such as the PointProcessManager) to set a value that lies outside the range 0..1e9
alexandrapierri
Posts: 69
Joined: Wed Jun 17, 2015 5:31 pm

Re: recording delivered pulses using pulsedistrib.zip

Post by alexandrapierri »

thank you Ted,

First I would like to say that the syntax: "h.ipulse2(bs.soma(0.5))" gives error "hoc object doesn't have attribute ipulse2" which tells me that I am using the wrong syntax. Should I use "insert" or a different syntax to deliver the pulses to the basket cell?

your comment about how the parameter "del" will automatically be known to Python as "delay" made me realize that the other params won't be known by hoc and therefore I tried the following syntax:

Code: Select all

from neuron import h
iclamp =h.Ipulse2(bs.soma(0.5))
dur_clamp=5
num_clamp=3
amp_clamp=20

h('dur=' +str(dur_clamp))
h('num=' +str(num_clamp))
h('amp=' +str(amp_clamp))
Even though dur, num, and amp are parameters of the Ipulse2.mod file, this syntax fails also!
I suppose my question is a more general one which is, how do I access parameters of mod files?

thank you again,
Alexandra
ted
Site Admin
Posts: 6286
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: recording delivered pulses using pulsedistrib.zip

Post by ted »

First I would like to say that the syntax
This works:

Code: Select all

from neuron import h
soma = h.Section(name='soma')
pstim = h.Ipulse2(soma(0.5))
"h.ipulse2(bs.soma(0.5))" gives error "hoc object doesn't have attribute ipulse2" which tells me that I am using the wrong syntax.
True. The class name is Ipulse2, not ipulse2.
your comment about how the parameter "del" will automatically be known to Python as "delay" made me realize that the other params won't be known by hoc
That inference is incorrect. The PARAMETERs of an instance of any NMODL-defined class are automatically accessible by hoc and Python. No fancy syntax is required. For example, in hoc, if foo is the objref that points to an instance of Ipulse2, foo's parameters are foo.del, foo.dur, foo.per, foo.num, and foo.amp. In Python, if foo is the name of a Python object that points to an instance of h.Ipulse2, the parameters will have the same names with one exception, and that exception is the delay paramter, whose Python name is foo.delay.

These statements

Code: Select all

dur_clamp=5
num_clamp=3
amp_clamp=20
are guaranteed to fail.

So are these

Code: Select all

h('dur=' +str(dur_clamp))
h('num=' +str(num_clamp))
h('amp=' +str(amp_clamp))
Read through the "ball and stick" model cell tutorial at https://nrn.readthedocs.io/en/latest/tu ... Basic-cell and by the time you get to code block number 39 you'll see the syntax for specifying the properties of a point process class that has 3 parameters: delay, dur, and amp.

IMO the Programmer's Reference documentation of the IClamp and SEClamp class should include examples of how to access the parameters of these classes.
Post Reply