Hi everyone,
I'm new to the boards and NEURON, so hopefully my question hasn't been answered a million times. From what I can tell though, there doesn't seem to be any easy way to control multiple simulations. Namely, is there a way I can parameter sweep various channel types in multiple identical setups without having to resort to a perl script that will spit out all the sims I need? (Ideally in hoc).
Thanks,
Eugene Kim
Multiple simulation control
-
- Site Admin
- Posts: 6394
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Of course. In the most general terms, you need to iterate over a range of parameters,is there a way I can parameter sweep various channel types in multiple identical setups without having to resort to a perl script that will spit out all the sims I need? (Ideally in hoc).
and for each new parameter set do the following:
--initialize the model (see comments at very end)
--run a simulation while recording simulation results
--possibly do some postrun analysis
--save results to a file
hoc is a fully qualified programming language with all the features that you might need to
deal with general programming aspects of these tasks, and NEURON's standard run
system (which you get by executing load_file("nrngui.hoc") or load_file("noload.hoc"))
gives you everything else.
General programming
* flow control (iteration, conditional execution)--for, while, iterator, break, continue
* pseudorandom sequence generation--the Random class
* sprint--to create run-specific file names
* file i/o--the File class
Instrumentation
* recording results in the course of a simulation--Vector and CVode record() methods
* stimuli--e.g. synaptic inputs (ExpSyn, Exp2Syn), NetCon class's event() method,
voltage clamp (SEClamp class) and current clamp (IClamp) that can do the usual "3 step
protocols" or be driven by events via FInitializeHandler or "continuously" by Vector play
(see below).
Simulation control
The standard run system gives you full control over initialization and execution of
simulations, plus the ability to customize either or both--see chapters 7 and 8 of The
NEURON Book. In addition to the features discussed in those chapters, you can
implement
* time-varying parameters during a simulation--Vector play() method
* complex "experimental protocols" involving sudden parameter changes in mid-run--CVode
class's event method with the FInitializeHandler class
Comments about initialization
Custom initialization may be necessary in the following cases. For information about how
to deal with them, read chapter 8 of The NEURON Book, and search The NEURON
Forum for
custom initialization
1. Models that have nonuniform biophysical properties, because resting potential is not
likely to be uniform. NEURON's default initialization starts the entire cell at the same
potential.
2. Models that involve ion accumulation mechanisms (diffusion, buffers, pumps etc.).
3. Adjustment of any ionic conductance (e.g. during exploration of parameter space).
4. Adjustment of temperature.
5. Spontaneously active model.
-
- Site Admin
- Posts: 6394
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
An idiom for exploring parameter space is
where
--new_params() is a function that generates a new set of parameters. Also decides whether
another iteration is needed; if so, returns 1, otherwise returns 0.
--adjust_params() changes the models parameters
--custom_init() does a custom initialization to ensure steady state, uniform v, etc.
--continuerun() is part of the standard run system, and tstop is the simulation stop time
--postprocess() does whatever analysis is needed before writing output to files
--savetofiles() saves simulation/analysis results to an output file. Depending on storage
requirements and time needed to execute a run, it may make sense to accumulate the
results of all simulations in a Matrix or as a list of Vectors, writing of which is deferred
until after exit from the while loop.
--args1 is a list of arguments that control the operation of new_params(). Not necessarily
the same as the arguments args2 that are passed to new_params().
Code: Select all
proc explore_params() { local working
working = 1
while (working==1) {
working = new_params(args2)
adjust_params()
custom_init()
continuerun(tstop)
postprocess()
savetofiles()
}
}
explore_params(args1)
--new_params() is a function that generates a new set of parameters. Also decides whether
another iteration is needed; if so, returns 1, otherwise returns 0.
--adjust_params() changes the models parameters
--custom_init() does a custom initialization to ensure steady state, uniform v, etc.
--continuerun() is part of the standard run system, and tstop is the simulation stop time
--postprocess() does whatever analysis is needed before writing output to files
--savetofiles() saves simulation/analysis results to an output file. Depending on storage
requirements and time needed to execute a run, it may make sense to accumulate the
results of all simulations in a Matrix or as a list of Vectors, writing of which is deferred
until after exit from the while loop.
--args1 is a list of arguments that control the operation of new_params(). Not necessarily
the same as the arguments args2 that are passed to new_params().
I would like very much to use your explore_params(), but have a hard time coding the new_params proc. Addicted to generators, I do not know another way to do procedures such as new_params. Could you give an example of how your new_params looks like? Thanks.ted wrote:An idiom for exploring parameter space iswhereCode: Select all
proc explore_params() { local working working = 1 while (working==1) { working = new_params(args2) adjust_params() custom_init() continuerun(tstop) postprocess() savetofiles() } } explore_params(args1)
--new_params() is a function that generates a new set of parameters. Also decides whether
another iteration is needed; if so, returns 1, otherwise returns 0.
--adjust_params() changes the models parameters
--custom_init() does a custom initialization to ensure steady state, uniform v, etc.
--continuerun() is part of the standard run system, and tstop is the simulation stop time
--postprocess() does whatever analysis is needed before writing output to files
--savetofiles() saves simulation/analysis results to an output file. Depending on storage
requirements and time needed to execute a run, it may make sense to accumulate the
results of all simulations in a Matrix or as a list of Vectors, writing of which is deferred
until after exit from the while loop.
--args1 is a list of arguments that control the operation of new_params(). Not necessarily
the same as the arguments args2 that are passed to new_params().