multiloading the same file with different values

Anything that doesn't fit elsewhere.
Post Reply
Anton Filipchuk
Posts: 4
Joined: Sat Nov 17, 2007 7:53 am
Contact:

multiloading the same file with different values

Post 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
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: multiloading the same file with different values

Post 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
}
Anton Filipchuk
Posts: 4
Joined: Sat Nov 17, 2007 7:53 am
Contact:

Re: multiloading the same file with different values

Post by Anton Filipchuk »

Thank you, it sounds reasonable, although at first it seemed much simpler to reload the file without changing the inside code.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: multiloading the same file with different values

Post 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.
Anton Filipchuk
Posts: 4
Joined: Sat Nov 17, 2007 7:53 am
Contact:

Re: multiloading the same file with different values

Post 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.
Post Reply