automating exploration of parameter space
automating exploration of parameter space
I'd like to ask you a couple of things more regarding the control of simulations. I was wondering if it's possible to repeat a simulation "n" times varying parameters in each run, like for example the onset of the action potential or the stimulus intensity without have to change it by hand in each iteration? And, what would be the best way to accomplish this?
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: automating exploration of parameter space
Execution of a series of simulations in which a parameter varies from one run to the next can be automated with one or more "for" loops or by using an "iterator". For example, suppose you have a model that is stimulated by current injected into the soma by an IClamp, and that the objref that points to the IClamp is called stim. This "for" loop will run a series of simulations in which the injected current ranges from 0.1 to 1 nA in 0.1 nA stepserhervert wrote:I'd like to ask you a couple of things more regarding the control of simulations. I was wondering if it's possible to repeat a simulation "n" times varying parameters in each run, like for example the onset of the action potential or the stimulus intensity without have to change it by hand in each iteration? And, what would be the best way to accomplish this?
Code: Select all
for j = 1,10 {
stim.amp = 0.1*i
run()
}
Code: Select all
iterator case() {local i
for i = 2, numarg() { //must begin at 2 because the first argument is in reference to the address
$&1 = $i // what is at the address will be changed
iterator_statement //This is where the iterator statement will be executed.
}
}
for case (&stim.amp, 0.1, 1/PI, sqrt(2)) {
run()
}
load_file("nrngui.hoc")
statement at the top of your main hoc file, i.e. the one that you use to launch your model).
It would be a good idea to read the Programmer's Reference entries about the for and iterator keywords.