Keeping the maximum voltage in a space plot
Keeping the maximum voltage in a space plot
I remember learning how to keep the maximum voltage as well as the voltage in a space plot when I first learned NEURON. How do you do it? Do you have to program it with a RangeVarPlot or is there an option similar to "KeepLines"?
-
- Site Admin
- Posts: 6305
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Keeping the maximum voltage in a space plot
Isn't it interesting that the context is retained long after the content has become (relatively) inaccessible.I remember learning how to . . .
The trick is to create a mod file that tests for extrema in an AFTER SOLVE block, and stores them in range variables. Here's a mod file for a distributed mechanism that will capture the max and min values of v, and the times of these extrema, in all nodes of all sections into which it has been inserted. The same strategy will work for any other range variable.
Code: Select all
NEURON {
SUFFIX extr : for "extrema"
RANGE vmax, vmin, tmax, tmin
}
ASSIGNED {
v (millivolt)
vmin (millivolt)
tmin (ms)
vmax (millivolt)
tmax (ms)
}
INITIAL {
vmin = v
tmin = t
vmax = v
tmax = t
}
AFTER SOLVE {
if (v < vmin) {
vmin = v
tmin = t
}
if (v > vmax) {
vmax = v
tmax = t
}
}