Increasing time resolution

The basics of how to develop, test, and use models.
Post Reply
mackenzie

Increasing time resolution

Post by mackenzie »

Hello-

I'm just getting started with NEURON and have what may be a simplistic problem that I can't seem to figure out... I want to get a higher temporal resolution look at my spikes. Changing the dt in the GUI Run Control certainly increases the run time as if its doing more work, but it doesn't increase the number of points plotted in my graph or the number of time points in the .dat file when i pick and save the vector. Is there a way to really change the dt and get a closer look at my spikes without slowing down the time constants of all of my channels by a factor of 10 or 100?

Thank you,

MacKenzie Howard
ted
Site Admin
Posts: 5869
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

The short answer: dt and # of points plotted per ms are not independent of each other.
There must be a whole number of integration steps between plotted points.

So either dt must be slaved to points plotted per ms, or vice versa. In NEURON, dt is
slaved to points plotted per ms. If you want finer temporal resolution in a plotted graph,
increase points plotted per ms. This is likely to force dt to be smaller.

How does NEURON slave dt to points plotted per ms?

As an informative exercise, start NEURON, bring up a RunControl panel
NEURON Main Menu / RunControl
then save it to a session file
NEURON Main Menu / File / save session
Call the session file foo.ses
Finally, exit NEURON.

Now use a text editor to open foo.ses and examine its contents.
Note the following:

Code: Select all

dt = 0.025
xvalue("dt","dt", 1,"setdt()", 0, 1 )
steps_per_ms = 40
xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 )
From the documentation of xvalue()
http://www.neuron.yale.edu/neuron/stati ... tml#xvalue
we discover that:
1. the values of dt and steps_per_ms are displayed in the numeric fields next to the
RunControl's "dt (ms)" and "Points plotted/ms" buttons
2. if you change the value of dt or steps_per_ms, hoc will then call setdt()

So it's reasonable to guess that setdt() verifies that dt is a whole number multiple of
1 / steps_per_ms, and if not, adjusts dt accordingly.

How to verify this guess?

You won't find anything about steps_per_ms or setdt() in the Programmer's Reference,
because they aren't part of the hoc or NMODL programming languages. Instead, they
are defined in NEURON's run time library. So let's examine the run time library to find
out more about them.

The run time library is in /usr/local/nrn/share/nrn/lib/hoc/stdrun.hoc on my Linux box
(under MSWin, stdrun.hoc is in c:\nrnxx\lib\hoc\). Searching stdrun.hoc for proc setdt(),
we find

Code: Select all

proc setdt() {local Dt, dtnew
        if (using_cvode_) return
        Dt = 1/steps_per_ms
        nstep_steprun = int(Dt/dt)
        if (nstep_steprun == 0) {
                nstep_steprun = 1
        }
        dtnew = Dt/nstep_steprun
        if (abs(dt*nstep_steprun*steps_per_ms - 1) > 1e-6) {
                print "Changed dt"
                dt = dtnew
        }
}
So if adaptive integration ("cvode") is being used, setdt() does nothing.
Otherwise, it uses dt to calculate nstep_steprun (the number of integration steps per
plotted point, which is forced to be a whole number), and, if necessary, sets dt equal to
1 / (steps_per_ms * nstep_steprun)
Post Reply