automating exploration of parameter space

Using the Multiple Run Fitter, praxis, etc..
Post Reply
erhervert
Posts: 13
Joined: Mon Nov 21, 2011 10:42 pm
Location: México City

automating exploration of parameter space

Post by erhervert » Fri Feb 03, 2012 11:38 pm

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?

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

Re: automating exploration of parameter space

Post by ted » Sat Feb 04, 2012 1:35 pm

erhervert 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?
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 steps

Code: Select all

for j = 1,10 {
  stim.amp = 0.1*i
  run()
}
and the following code will execute three simulations, in which the stimulus amplitude will be 0.1, 1/PI, or sqrt(2) nA

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()
}
These exampes assume that you are using NEURON's standard run system (just make sure there is a
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.

Post Reply