Random pulses

The basics of how to develop, test, and use models.
Post Reply
vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Random pulses

Post by vladimirov » Fri Feb 24, 2012 5:57 pm

I need a random time series of current pulses delivered to axon, with exponentially distributed times between successive pulses. How could I possibly do this?
Thank you!
Nik

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

Re: Random pulses

Post by ted » Sat Feb 25, 2012 12:45 am

(This was sufficiently different from the previous question that I split it off into a new thread.)

How many of these pulses do you need--less than a dozen, or more?

vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Random pulses

Post by vladimirov » Mon Feb 27, 2012 11:03 am

Hi, Ted,
I need some hundreds of pulses per network, pulses delivered to random cells at random times. Kind of Poisson noisy input for a network (100 cells or more, anatomically reconstructed).
Thanks,
Nik

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

Re: Random pulses

Post by ted » Mon Feb 27, 2012 9:49 pm

Do you really want "current pulses" i.e. each pulse is identical to all others in amplitude and time course, or do you want conductance change synapses? What should be the waveform of each pulse?

vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Random pulses

Post by vladimirov » Tue Feb 28, 2012 11:25 am

These should be current pulses, delivered to distal axons and making them to spike 1 or more times, depending on pulse duration or amplitude. Waveform can be square, with parameters ton, amp as in generic Ipulse1 mechanism, and toff being a random exp. distributed variable. Any ideas to how implement this? Thanks!

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

Re: Random pulses

Post by ted » Wed Feb 29, 2012 4:14 pm

Lots of ideas, but which is best for your application is the question. There are at least two or three different ways to do exactly what you requested, but I just want to be sure that there isn't something more direct and efficient that would do the job. My understanding of your application is that you have a network model that you want to drive with afferent spikes. The most efficient way to do that is to use NetStims to generate spike events, and connect the NetStims to synaptic mechanisms on the target neurons. NEURON's ready to do that out of the box, no axons needed at all. NetStims can produce events with negexp statistics. It doesn't sound like you're interested in the "analog + digital" signaling story (the idea that, although transmitter release is triggered by spikes, the amount of transmitter released is modulated by subthreshold fluctuations of v in the presynaptic terminal, caused by spread of current from the soma). The only other reason I can imagine for to bothering with axons driven by current pulses is if you have a particular interest in what happens in the axons themselves, i.e. maybe you're thinking about propagation failures at branch points, or you want to stimulate at such a high rate that spikes start to drop out. If it would help to continue this discussion via email, feel free to contact me -- ted dot carnevale at yale dot edu

vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Random pulses

Post by vladimirov » Wed Feb 29, 2012 6:06 pm

Hi, Ted,
I am actually interested primarily in what happens in axons, with propagation failures and antidromic spikes. In principle, my model is all around axons, rather than soma and dendrites. Is there any way to implement the random drive to axons? I keep posting here because maybe our discussion is relevant/interesting for others, too.
If you could give some hints how to implement required mechanism in NMODL file, it would be great. I would then include the mechanism into ends of axons, and this would solve the thing.
Thanks,
Nik

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

Re: Random pulses

Post by ted » Wed Feb 29, 2012 10:36 pm

I would suggest an approach that borrows from the ExpSyn mechanism. What I have in mind is built around a point process current source that is driven by events. Might as well call this mechanism something; I'm incined to call it Ipsyn because, in a sense, it is a "current pulse synaptic mechanism."

An Ipsyn would initially be off. Arrival of an event would turn it on (Ipsyn.i changes from 0 to "amp") and launch a self event that, after a user-specified interval "dur", would turn it back off.

If an event arrives while it is already on, what should happen? nothing? or should the "turn off" time be moved to t+dur? (i.e. prolonging the present current pulse)

Every axon you wish to stimulate would have an instance of this mechanism attached to it, and every instance of this mechanism would be associated with its own NetStim that generates the events that drive it; a NetCon would connect the two. If your model involves more than 1 Ipsyn, and you wanted each to deliver pulses at times that are statistically independend of each other, each NetCon would have to be paired with its own instance of the Random class, each of which would use the MCell pseudorandom generator that is configured to produce an event stream that is independent of all others.

vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Random pulses

Post by vladimirov » Thu Mar 01, 2012 1:03 pm

So, an external random number generator can stimulate axons via their NetStim's? I don't need to build in random numbers into NMODL file of the (synaptic) stimulation mechanism?

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

Re: Random pulses

Post by ted » Fri Mar 02, 2012 1:26 am

Well, you didn't answer this question
If an event arrives while it is already on, what should happen? nothing? or should the "turn off" time be moved to t+dur? (i.e. prolonging the present current pulse)
so I just assumed that the correct thing to do is ignore events that arrive while a previous pulse is on. That's easy enough to change if I didn't guess correctly.

Here's the code. I decided to call this new class Ipulse3 because it is the third variation on the theme of "pulse generators" that I have developed.

Code: Select all

COMMENT
  ipulse3.mod
  Generates a current pulse when it receives an input event.
  User specifies dur (pulse duration) and amp (pulse amplitude).
  Ignores events that arrive during an ongoing pulse.
  version 1.0 NTC
ENDCOMMENT

NEURON {
  POINT_PROCESS Ipulse3
  RANGE dur, amp, i
  ELECTRODE_CURRENT i
}

UNITS {
  (nA) = (nanoamp)
}

PARAMETER {
  dur (ms) <0, 1e9> : duration of ON phase
  amp (nA) : how big
}

ASSIGNED {
  ival (nA)
  i (nA)
  on
}

INITIAL {
  on = 0
  i = 0
  ival = 0
}

BREAKPOINT {
  i = ival
}

NET_RECEIVE (w) {
  if (flag == 0) { : not a self event
    if (on == 0) {
      : turn it on
      ival = amp
      on = 1
      : prepare to turn it off
      net_send(dur, 1)
    }
  } else { : a self event
    : turn it off
    ival = 0
    on = 0
  }
}
Save this to a file called ipulse3.mod, then compile it with mknrndll or nrnivmodl, depending on your OS.

Example of usage: suppose you want to attach an Ipulse3 to the 0.9 location on a section called axon.

Code: Select all

objref ip
axon ip = new Ipulse3(0.9)
ip.dur = 0.1 // ms, a good "experimentalist's" value
ip.amp = 0.1 // nA, reasonable for 100 um2 single compartment with HH
  // but probably too big for any axon with diameter < 5 um
  // change this to about 2x threshold value

objref ns
ns = new NetStim()
ns.interval = 50 // mean time between events
ns.number = 1e9 // essentially unlimited
ns.start = 10
ns.noise = 1 // ISIs are governed by negexp distribution

vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Random pulses

Post by vladimirov » Fri Mar 02, 2012 4:49 pm

Wow, Ted, many thanks for the code. It would take me days to figure out how to write this thing properly.
In case any beginner needs complete code: after defining ns in Ted's code, just add

Code: Select all

objref nc
axon nc = new NetCon(ns,ip)
nc.threshold = 0
nc.weight = 1   
nc.delay = 0
and enjoy the random spikes.
Sorry that I didn't answer the question about event arriving when current step is already on. "Do nothing" is the right answer :)
Thanks a lot!

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

Re: Random pulses

Post by ted » Sun Mar 04, 2012 12:34 am

Glad to help. Writing NMODL code that takes advantage of the event delivery system is basically an exercise in crafting finite state machines. It is often possible to start with one or more existing files that come close to doing what one wants, and make a series of modifications until one has something that works. This particular mod file borrows ideas from the saturating synapse model in chapter 10 of the NEURON Book and from the source code for IClamp (nrn-7.2/src/nrnoc/stim.mod in the source code tree). The idea of using a NetStim to generate the event train that drives it is just a natural consequence of NEURON's modularity and my aversion to reinventing the wheel (NetStim's mod file, netstim.mod, is in the same directory and is full of interesting stuff).

In the midst of all this cleverness, I forgot entirely about the statements for creating the NetCon that connects the NetStim to the Ipulse3. As they say, the devil is in the details.

vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Random pulses

Post by vladimirov » Tue Mar 06, 2012 3:53 pm

Your help is greatly appreciated!

Post Reply