Page 1 of 1
Multiple simulations: spawning a new graph on each run
Posted: Wed Jun 25, 2008 10:53 am
by tsa
Hello,
I am also trying to automate multiple simulations. I am examining a single bursting cell and varying a maximal conductance with each automated simulation. Though I have the automated process to vary the conductance and repeatedly run the simulation down correctly I have not figured out how to make each trial output to a separate graph without overwriting the previous trials. Currently each trial outputs a voltage trace to the same graph via the Keep Lines option but this makes examining the data quite difficult due to trace overlap. Any advice would be greatly appreciated.
Re: Multiple simulations: spawning a new graph on each run
Posted: Wed Jun 25, 2008 12:43 pm
by ted
Each time you spawn a graph that you want to save, append it to a List. Example:
Code: Select all
objref g, glist
glist = new List()
proc myrun() {
g = new Graph()
glist.append(g)
run()
}
Re: Multiple simulations: spawning a new graph on each run
Posted: Wed Jun 25, 2008 2:22 pm
by tsa
Thanks Ted, however now I am returned multiple graph windows as the simulations complete but no voltage trace is plotted on any of the graphs.
My code for myrun is as follows:
proc myrun() {
graph5 = new Graph()
graph5.addvar("Cell[0].soma.v(0.5)", 3,1,0.8,0.9,2)
glist.append(graph5)
run()
}
Re: Multiple simulations: spawning a new graph on each run
Posted: Wed Jun 25, 2008 2:51 pm
by ted
Did you rescale the axes with View = plot?
g.exec_menu("View = plot")
Be sure to read the Programmer's Reference info about the Graph class's exec_menu method.
If you don't like the default appearance created by View = plot, you can have complete control over axis scaling etc. by following the approach described here
How to use hoc to plot a variable vs. time
http://www.neuron.yale.edu/phpBB/viewto ... f=30&t=552
Re: Multiple simulations: spawning a new graph on each run
Posted: Wed Jun 25, 2008 3:03 pm
by tsa
The axis are scaled correctly and using "view = plot" does not reveal anything new. On a separate graph I can visualize the voltage traces as the simulations run, though each voltage trace is overwritten at the beginning of a new simulation. However, no traces appear on the graph's created by the myrun() procedure.
Re: Multiple simulations: spawning a new graph on each run
Posted: Thu Jun 26, 2008 11:45 am
by tsa
I realized I omitted the vital line: graphlist[0].append(graph5). With its inclusion I now have a new graph created upon each trial and each new graph plots the voltage trace. However, each graph respawns the previous voltage trace as each new trial is automatically run. Is there a way to essentially turn off the automated updating of the graph upon the completion of each simulation?
Re: Multiple simulations: spawning a new graph on each run
Posted: Fri Jun 27, 2008 3:40 pm
by ted
tsa wrote:However, each graph respawns the previous voltage trace as each new trial is automatically run.
Actually, each graph will show the results from the _current_ simulation, because each graph has the same variable in its plot list, and that variable's values are generated anew in the course of each simulation.
So use the Vector class's record() method to capture the time course of variables of interest, then plot them after the end of each simulation. Example (assumes the existence of a section called soma):
Code: Select all
objref vvec, tvec, glist, g
vvec = new Vector()
vvec.record(&soma.v(0.5))
tvec = new Vector()
tvec.record(&t)
glist = new List()
proc myrun() {
run()
g = new Graph()
vvec.plot(&g, t)
glist.append(g)
}