Page 1 of 1

multiloading the same file with different values

Posted: Fri Feb 27, 2009 6:27 am
by Anton Filipchuk
Hi!
I'm trying to automatize the process of electrotonic profiles building for different values of Rm. The problem is that I need to use about 20 differernt values of Rm for each neuron so it takes a lot of time: I load the .hoc file (creating electrotonic profile), I change the Rm value, I save it and I reload it again. And so on, 20 times! So I wanted to load this hoc automatically changing Rm.
I created another hoc with the following code:

g_pas_changeable=0.02
xopen("get_tx.hoc")

g_pas_changeable=0.018
xopen("get_tx.hoc")
.
.
.
g_pas_changeable=0.0001
xopen("get_tx.hoc")

The same with "load_file".
get_tx.hoc - file creating electrotonic profile, where g_pas value is equal to g_pas_changeable.
The problem is that it works correctly only for the first loading of the get_tx.hoc, and then it seems to change g_pas_changeable but without implementing it for the simulations programmed inside the get_tx.hoc.
So at the first glance it seems to work correctly: it gives the set of electrotonic profiles, but then it turns out that all of them are the same - as the first one.

Is there any other way to load the same hoc-file several times so that it is executed with different values of internal parameters set outside (g_pas in this case)?

Thank you in advance for your answer

Re: multiloading the same file with different values

Posted: Fri Feb 27, 2009 10:35 am
by ted
Sounds like the wrong approach altogether. Why not write a program that does the following?

Code: Select all

create model cell
for each parameter value {
  for all affected sections set g_pas to the parameter value
  perform electrotonic analysis
  record results of analysis
}

Re: multiloading the same file with different values

Posted: Mon Mar 02, 2009 4:37 pm
by Anton Filipchuk
Thank you, it sounds reasonable, although at first it seemed much simpler to reload the file without changing the inside code.

Re: multiloading the same file with different values

Posted: Mon Mar 02, 2009 5:06 pm
by ted
Work harder or work smarter, as they say.

Suggestions:
1. Be sure to call finitialize() after each parameter change, to ensure that the change will affect the electrotonic analysis.

Code: Select all

(pseudocode)
for each parameter value {
  for all affected sections set g_pas to the parameter value
  finitialize()
  perform electrotonic analysis
  record results of analysis
}
2. If the parameter change is supposed to affect only a subset of sections, first append the sections to a SectionList, then use
forsec seclistname
to iterate over the affected sections.

Re: multiloading the same file with different values

Posted: Tue Mar 03, 2009 5:48 pm
by Anton Filipchuk
Thank you, Ted!!!! This only finitialize() at the beginning of the file changed everything!
Now it works as I wonted! Because of the absence of the finitialize() function the program didn't reinitialize the parameter inside the hoc-file.