assigning fitting parameters to different subsets
assigning fitting parameters to different subsets
I have a model with three subsets: soma, primary trunks and dendrites. I want to make a fit in which my fitting variable is the voltage at the soma and my fitting parameters are g_pas (passive conductance) and gbar_kir (inward rectifier conductance). However I would like to assign the parameters independently to the three subsets. How do I tell the fitter (single or multiple) to give different values to g_pas in the different subsets ? Thanks in advance.
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
using dummy variables and a custom init() for optimization
This is a great question.
A convenient way to do what you want is to create a dummy variable for each of your
subsets that will hold the corresponding value of g_pas. Set up the MultipleRunFitter
(MRF) so that the parameters it changes are the values of these variables.
Use a custom init() that assigns the value of each dummy variable to g_pas for
the sections in the corresponding subset.
For example, suppose your code is divided into several files that are managed by
a single init.hoc whose contents are
Also suppose that your subsets are contained in SectionLists called somset,
primset, and dendset.
Make a new hoc file called params.hoc that contains the following statements
Then change your init.hoc so that it loads params.hoc just before the line that loads
your Multiple Run Fitter.
When NEURON reads this new init.hoc, it will know about the dummy parameters
(gpassom, gpasprim, and gpasdend) before it loads your Multiple Run Fitter. This
means you will be able to use the MRF's Add Parameter panel to specify gpassom
etc. as the parameters to be optimized.
We're taking advantage of the fact that hoc is an interpreted language, which means
that we can redefine any proc or func by simply feeding a new definition to the
interpreter. So our custom init(), which is parsed long after the load_file("nrngui.hoc")
statement, replaces the standard run system's default init(). Every iteration of the MRF
starts by initializing the model, and the first three statements in our custom init() ensure
that the sections in our three sets get the desired values of g_pas from our dummy
variables--which the MRF has adjusted to improve the fit.
A convenient way to do what you want is to create a dummy variable for each of your
subsets that will hold the corresponding value of g_pas. Set up the MultipleRunFitter
(MRF) so that the parameters it changes are the values of these variables.
Use a custom init() that assigns the value of each dummy variable to g_pas for
the sections in the corresponding subset.
For example, suppose your code is divided into several files that are managed by
a single init.hoc whose contents are
Code: Select all
load_file("nrngui.hoc")
load_file("cell.ses") // specifies properties of the cell
load_file("rig.ses") // RunControl, graphs, Multiple Run Fitter etc.
primset, and dendset.
Make a new hoc file called params.hoc that contains the following statements
Code: Select all
gpassom = 0.003 // or whatever initial values you want them to be
gpaspri = 0.003
gpasdend = 0.003
proc init() {
forsec somset g_pas = gpassom
forsec primset g_pas = gpasprim
forsec dendset g_pas = gpasdend
finitialize(v_init)
if (cvode.active()) {
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}
your Multiple Run Fitter.
Code: Select all
load_file("nrngui.hoc")
load_file("cell.ses") // specifies properties of the cell
load_file("params.hoc") // dummy parameters and custom init()
load_file("rig.ses") // RunControl, graphs, Multiple Run Fitter etc.
(gpassom, gpasprim, and gpasdend) before it loads your Multiple Run Fitter. This
means you will be able to use the MRF's Add Parameter panel to specify gpassom
etc. as the parameters to be optimized.
We're taking advantage of the fact that hoc is an interpreted language, which means
that we can redefine any proc or func by simply feeding a new definition to the
interpreter. So our custom init(), which is parsed long after the load_file("nrngui.hoc")
statement, replaces the standard run system's default init(). Every iteration of the MRF
starts by initializing the model, and the first three statements in our custom init() ensure
that the sections in our three sets get the desired values of g_pas from our dummy
variables--which the MRF has adjusted to improve the fit.