Injecting noise

Anything that doesn't fit elsewhere.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Injecting noise

Post by ted »

On Mon Dec 16, 2013 1:06 am, ps0322 asked:
ps0322 wrote:I want to injected fluctuated current with noise to a cell ( the Ipulse3 varies the event time with fixed current amplitude).
Would you please suggest me how could I do that? My idea is make the vector of fluctuation current and add some noise. For the noise, I'll have to varies the seed also.

I quote NET_RECEIVE block of Ipulse3.mod here.

Code: Select all

NET_RECEIVE (w) {
  if (flag == 0) { : not a self event
    if (on == 0) {
      : turn it on
      ival = amp     //the amp will change to vector not scalar
      on = 1
      : prepare to turn it off
      net_send(dur, 1)
    }
  } else { : a self event
    : turn it off
    ival = 0
    on = 0
  }
}
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Injecting noise

Post by ted »

Do you want noisy current pulses, or do you want continuous background noise?
What statistical properties do you want the noise to have?
ps0322

Re: Injecting noise

Post by ps0322 »

I want to make continuous background noise as gaussian noise. Am I answer the questions?
ps0322

Re: Injecting noise

Post by ps0322 »

I'm confused exactly NetStim do and whether NetStim can do this
" make continuous background noise(by fluctuated current injection) as gaussian noise"
or not.

From what I understand NetStim inject 'steady' current(same 'amp') to the cells with variation in time of injection. If it correct, then, I cannot make the background noise I want by NetStim. Then, I also wonder how is it different from Ipulse3? How the NetStim similar or different from poissoin generator?

Thank you in advance.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Injecting noise

Post by ted »

The NetStim class is a type of artificial spiking cell. In NEURON, artificial spiking cells generate events that can drive other artificial spiking cells, or synaptic mechanisms attached to biophysical model cells. A biophysical model cell is a model cell that is based on the cable equation, and is implemented with one or more sections. To learn more about spike-triggered synaptic communication between cells, event-driven synaptic mechanisms, and artificial spiking cells, read chapter 10 of The NEURON Book. If you don't have the book, read this early draft of chapter 10
http://www.neuron.yale.edu/ftp/ted/book ... xedref.pdf
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Injecting noise

Post by ted »

ps0322 wrote:I want to make continuous background noise as gaussian noise.
Then you need something like a current clamp, but one that injects current that fluctuates according to a gaussian distribution. I'm working on something like that now, and may have it ready for you shortly.
ps0322

Re: Injecting noise

Post by ps0322 »

Thank you so much.
I'm working on something like that now, and may have it ready for you shortly.
Normally, when you update some new function or new mod files, I wonder where are you posting information about them? So that, I could catch all the updates. (I'm so new to NEURON)
Thank you once again.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Injecting noise

Post by ted »

New code that is developed in response to questions from users may be incorporated into NEURON itself if it is of sufficiently wide interest and also amounts to a significant advance in NEURON itself. Code that is not quite so important may be described in the Hot tips or NEURON hacks areas of the Forum, or it may be used as the basis for a tutorial on NEURON's Documentation page http://www.neuron.yale.edu/neuron/docs. Code that is only of limited interest will be discussed in the particular discussion thread where the relevant question was posed.
ps0322

Re: Injecting noise

Post by ps0322 »

Thank you so much.
Also, Merry Christmas and Happy New Year, Ted !
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Injecting noise

Post by ted »

At long last, here it is:
http://www.neuron.yale.edu/ftp/ted/neur ... _noise.zip
To see it work, unzip this file, compile the mod file in it, then use NEURON to launch initgausshist.hoc
Set tstop to 1000, then enter the command
myrun()
at the oc> prompt. You'll see a plot of membrane potential in a single compartment passive model, the injected noise current, and a histogram of the injected current amplitudes.

ingauss.mod defines a point process (point current source) called InGauss that has the following parameters:
mean mean current injected (nA)
stdev standard deviation (nA)
del time at which noise current starts (ms)
dur duration of noise current (ms)

This mechanism is intended for use with fixed time steps only, since it generates a new current value at each advance of the simulation.

If you need to inject noise current into more than one segment of a model, attach a separate instance of InGauss to each segment and scale its standard deviation according to the compartment's surface area (assuming you want uniform noise current per unit of surface area).

To ensure that each noise source is independent of every other noise source, create a separate instance of the RandomStream class for each instance of InGauss, associate it with that InGauss instance, and assign it a unique "stream" parameter. The RandomStream class is defined by the template in ranstream.hoc, and initgausshist.hoc shows how to associate a RandomStream instance with an InGauss instance. If there is more than one InGauss, and each InGauss has been appended to a List called inlist,

Code: Select all

objref rslist
rslist = new List()
for i = 0,noiselist.count-1 {
  rslist.append(new RandomStream(i))
  inlist.o(i).noiseFromRandom(rslist.o(i).r)
}
should do the job.
ps0322

Re: Injecting noise

Post by ps0322 »

Hope this is not too late to say, THANK YOU so much!
ps0322

Re: Injecting noise

Post by ps0322 »

Hi Ted,
I've seen you mentioned somewhere(in a post that you refer him to this post, I can't find the post now) that you plan to change the random generator in this mechanism from mcell_ran4 to random123. I wonder have you try the InGauss with random123?
I've used this mechanism that you provided and got some problem.
Note that this is my first time working with mcell_ran4. I've read all the documents about randomness ( http://www.neuron.yale.edu/neuron/node/59 and its successors), but still do not know why I got dependent streams. The raster plots of 1000 independent cells, which no local connection between them, shows some periodicity as in the attached image. I've set the random_stream_offset_ = (tstop+1000)*1/dt to ensure that difference between highindex starting values would be greater than the length of each stream.


<< December 9, 2019 NOTE FROM MODERATOR: The referenced figure has vanished from the Internet. In its place appeared a big graphic supplied by whoever now owns the URL that was referenced. This is not something we want to allow on the NEURON Forum. >>


Now, I'm changing its random seed generator to random123. It'd be good practice, however, if I know what went wrong in the last trials.
Thank you in advance!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Injecting noise

Post by ted »

ps0322 wrote:this is my first time working with mcell_ran4. I've read all the documents about randomness ( http://www.neuron.yale.edu/neuron/node/59 and its successors), but still do not know why I got dependent streams. The raster plots of 1000 independent cells, which no local connection between them, shows some periodicity as in the attached image. I've set the random_stream_offset_ = (tstop+1000)*1/dt to ensure that difference between highindex starting values would be greater than the length of each stream.
To advise you about this, I'll have to see your code. If you zip up the hoc and ses files you used and email it to
ted dot carnevale at yale dot edu
I'll tell you what I find out.
ps0322

Re: Injecting noise

Post by ps0322 »

Hello Ted,
While preparing the files for sending to you, I found the problem. So I post it here just in case someone got the same mistake.
It's actually really trivial mistake.

I've change the random_stream_offset_ to
random_stream_offset_ = (tstop+1000)*1/dt
Because I want to make sure that the streams always independent from each other when I change run time.
However, the line for user specified tstop come after I called the function to insert InGauss. That is, tstop in the line [ random_stream_offset_ = (tstop+1000)*1/dt ] took initial value, which is 5ms. Therefore, the random_stream_offset_ for each InGauss instance is lower than the length of its stream. And, that cause the problem.


I've another question. For this InGauss function, the cell depolarize if the injected current is negative, and the cell hyperpolarize if the inject current is positive. This is opposite to what happen with IClamp.
Is there the reason behind this?
Thank you.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Injecting noise

Post by ted »

ps0322 wrote:While preparing the files for sending to you, I found the problem. So I post it here
That's great! Thanks for fixing that, and describing how you fixed the problem.
For this InGauss function, the cell depolarize if the injected current is negative, and the cell hyperpolarize if the inject current is positive. This is opposite to what happen with IClamp.
Is there the reason behind this?
Good question. You have just described the difference between the sign convention used for transmembrane currents and the convention used for currents that are applied with a microelectrode. Most users who want a "noise current" typically want something that mimics the effect of spontaneous fluctuation of transmembrane current, e.g. channel noise or background synaptic noise. That's why the current generated by InGauss is declared to be a NONSPECIFIC_CURRENT. An SEClamp or IClamp, however, is an external signal source that injects charge directly into the interior of a cell through a microelectrode, and you will see that the currents generated by those mechanisms are declared to be ELECTRODE_CURRENTs.

For more information about this and other NMODL-related questions, read either chapter 9 of the NEURON Book, or see
Hines, M.L. and Carnevale, N.T.
Expanding NEURON's repertoire of mechanisms with NMODL.
Neural Computation 12:995-1007, 2000
(get the "enhanced preprint" from http://www.neuron.yale.edu/neuron/nrnpubs)
Post Reply