ACG amplitude

Anything that doesn't fit elsewhere.
Post Reply
pfortier

ACG amplitude

Post by pfortier »

I wanted to use the ACG random number generator to inject random noise using

objref r
r = new Random()
r.ACG(7)
r.play(&IClamp[0].amp)

but I needed to set the amplitude lower. How do you set it lower? All I could do is use a normal random number generator as follows

objref r
r = new Random()
r.normal(0,0.001)
r.play(&IClamp[0].amp)

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

Post by ted »

The generators produce intermediate results that have a fixed number of bits. They do not
have an argument that is meant to be used to specify "amplitude" of the result. That is what
the arguments to the distribution are for, i.e. typical usage is
1. create an instance of the Random class
2. specify the generator (ACG, MLCG, or MCellRan4). The seed that initializes the
sequence can be specified at any point after this step.
3. specify the distribution (which takes arguments that are related to mean and variance)
4. specify how the samples from the distribution will be used

Is there a particular reason why you want to omit step 3, using the ACG's raw output instead
of specifying one of the many kinds of distributions that are available? If what you want is a
sequence of numbers that are uniformly distributed over a particular interval, why not use
the uniform distribution?
pfortier

Post by pfortier »

I thank you for your response. Unfortunately, I'm still learning and have not reached the point where I clearly understand your statements. I enclose an example of what I am trying to do:

create soma
access soma
soma {
nseg = 1
diam = 18.8
L = 18.8
Ra = 123.0
insert hh
gnabar_hh = 0.25
gl_hh = .002
el_hh = -60.0
}
objectvar stim
soma {
stim = new IClamp(0.5)
stim.del = 100
stim.dur = 100
stim.amp = 0.1
}
objref r
r = new Random()
//r.ACG(7) <-- I don't know how to scale values from the ACG function
r.normal(0,0.001) // <-- I can scale using the normal function
r.play(&stim.amp)
v_init = -62.6
tstop=300
objectvar save_window_
{
save_window_ = new Graph(0)
save_window_.size(0,300,-80,40)
save_window_.view(0, -80, 300, 120, 435, 72, 486, 200)
graphList[0].append(save_window_)
save_window_.addexpr("soma.v(.5)", 1, 1, 0.8, 0.9, 2)
}
{
save_window_ = new Graph(0)
save_window_.size(-1,50,0,50)
save_window_.view(-10, 0, 310, 0.11, 435, 350, 486, 200)
graphList[1].append(save_window_)
save_window_.addvar("IClamp[0].i", 1, 1, 0.8, 0.9, 2)
}
run()
Graph[1].exec_menu("View = plot")

I might understand better if you provide an example.

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

Post by ted »

Press et al. wrote a series of books called
Numerical Recipes in X
where X is FORTRAN, C, Pascal. See Chapter 7 in any one of them for a good introduction
to how "random numbers" are computed. The basic scheme is to start with a "generator"
that uses an algorithm to compute a pseudorandom sequence of integers that range from
0 to some maximum value MAX. This approximates a uniform distribution over the range
0 . . . MAX. These values are the raw stuff that other algorithms use to compute variables
with user-specified distributions, that you would actually use in your own programs.

If you're looking for examples of code that show how to use NEURON's Random class,
see the documentation in the Programmer's Reference
http://www.neuron.yale.edu/neuron/stati ... andom.html

Code: Select all

//r.ACG(7) <-- I don't know how to scale values from the ACG function
First, r.ACG(7) sets the ACG's seed to 7; it has no effect on the value of MAX.
Second, and more important, one doesn't scale the values that ACG generates. Under
normal circumstances, one does not deal directly with the integers produced by ACG or
any other generator. The "size" argument (see the documentation in the Programmer's
Reference) governs the value of MAX, but MAX has nothing to do with the magnitude of
the results returned by r.method() (where method is uniform, normal, negexp
etc.) or r.repick().
pfortier

Post by pfortier »

Thank you for your help. I have a copy of Numerical Recipies in C. I will look up the chapter on random numbers. If I understood correctly, I can't set

r.ACG(7)

to return random numbers scaled by a user defined factor. So I would have to do something like use ACG() to create a vector, scale the vector, and then play it. Alternatively, I could create an run() loop that, at each timestep, picks an ACG random number, rescales it, and injects it into the neuron.

I will have a network of at least 25 neurons, each receiving its own random noise starting at different seeds. I will continue to investigate the best approach.

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

Post by ted »

pfortier wrote:If I understood correctly, I can't set

r.ACG(7)

to return random numbers scaled by a user defined factor. So I would have to do something like use ACG() to create a vector, scale the vector, and then play it.
How can I be more explicit: fiddling with ACG's returned integer is exactly what you shouldn't do. Use the uniform distribution, i.e. in your code change the r.normal() call to r.uniform(),
with whatever arguments you want it to have.
pfortier

Post by pfortier »

Thanks again for your help. I got it now! The random numbers returned by the function r.ACG() should NOT be rescaled. I suspect that is why the function does not provide the means for the returned values to be rescaled. I will use the Random class functions that allow rescaling (e.g. uniform).

Thanks,
Pierre
Post Reply