Page 1 of 1
Analyzing vector during record?
Posted: Mon Nov 13, 2006 4:57 pm
by mctavish
I am doing some batch processing, recording a vector during each run. During the run, I would like to periodically analyze the vector being recorded to determine if I can abort the particular run instead of having it run to completion before analyzing the vector. Is this possible? How?
Thanks,
Tom
Posted: Mon Nov 13, 2006 8:38 pm
by ted
The first question is whether it is necessary to do that. What criterion would dictate whether
it makes sense to continue or to stop the simulation?
Posted: Mon Nov 13, 2006 10:40 pm
by mctavish
I am modifying parameters then running my simulation to see if the neuron fires at a particular number of times during the simulation. If it becomes apparent that the neuron will not be able to attain the number I'm looking for, I'd like to abort. Note, this is a biophysical model.
Posted: Tue Nov 14, 2006 10:26 am
by ted
In pseudocode
Code: Select all
TTEST is the time at which you want to check the number of spikes.
For the sake of this example,
let's say you want the number of spikes that occur
within the first TTEST ms to lie in the range {MINSP, MAXSP]
TFULLRUN (which is > TTEST) is how long you'd let the simulation run
if it passes the test you apply at TTEST.
objref spiketimes, nc, null
spiketimes = new Vector()
// assuming that the cell's spike trigger zone is the (0.5) location
// of the default section
nc = new NetCon(&v(0.5), null)
nc.record(spiketimes) // records spike times to Vector spiketimes.
tstop = TTEST
func myrun() {
run()
if ((spiketimes.size()>=MINSP) && (spiketimes.size()<=MAXSP)) {
// I just lifted these from the ses file for a RunControl panel
// but you should also read about them in the chapter 7
// of The NEURON Book.
// Also see the Programmer's Reference documentation on stoprun.
continuerun(TFULLRUN)
stoprun = 1
return 1 // means "full run"
} else {
return 0 // means "short run"
}
}
Posted: Tue Nov 14, 2006 9:29 pm
by mctavish
Thanks, Ted! I'll give it a whirl.
Posted: Tue Nov 14, 2006 9:56 pm
by ted
Let me know how it works out. It's a very simple strategy; much more complexity is
possible, if warranted, by exploiting NEURON's event delivery system--conditional
interruption and resumption of simulations, where the condition may depend on almost
arbitrarily complex specifications.