Stimulus Activation/Deactivation in NMODL
Posted: Sat Aug 05, 2023 5:04 pm
I made the following NMODL file to deliver a transmembrane current injection into a cell. The RANGE variable amp receives a played-in vector from a Python script. Below, I show the original method (which doesn't work quite right) and the second method (which does).
The difference between them is only evident for nanosecond-scale (or GHz frequency) pulses; in essence, the excitation threshold found in NEURON for this time/frequency regime is well below expected values (with method #1).
My question is why is this a necessary step? Does the divergence of the two methods indicate some clumsiness in my variable time-step method (in the 'parent' Python file)? Again, the NMODL file now does what I need, so I'm only curious if there is a general rule of usage I could/should learn from this episode.
The difference between them is only evident for nanosecond-scale (or GHz frequency) pulses; in essence, the excitation threshold found in NEURON for this time/frequency regime is well below expected values (with method #1).
My question is why is this a necessary step? Does the divergence of the two methods indicate some clumsiness in my variable time-step method (in the 'parent' Python file)? Again, the NMODL file now does what I need, so I'm only curious if there is a general rule of usage I could/should learn from this episode.
Code: Select all
NEURON {
SUFFIX direct_inject
NONSPECIFIC_CURRENT i
RANGE i, amp, delay, pw
}
UNITS {
(mV) = (millivolt)
(uA) = (microamp)
(mA) = (milliamp)
}
PARAMETER {
:amperage = -2e-2 (uA/cm2)
}
ASSIGNED {
i (mA/cm2)
amp (uA/cm2)
delay (ms)
pw (ms)
}
INITIAL {
i = 0}
BREAKPOINT {
: FIRST, I TRIED THIS LINE. THE FUNCTION DID NOT PERFORM AS EXPECTED.
: i = -amp*(1e-3)
: WHEN THE ABOVE FAILED, I IMPLEMENTED THE CODE BELOW
LOCAL X
at_time(delay) : THESE TWO at_time() LINES WERE TRIED WITH THE FIRST METHOD, BUT DID NOT SUFFICE
at_time(delay+pw)
if (t > delay && t < delay+pw) {
X = 1 : THIS "GATING VARIABLE" APPEARS TO BE THE KEY
}
else {
X = 0
}
i = -amp*(1e-3)*X : WITH THIS IMPLEMENTATION, THE FUNCTION WORKS AS EXPECTED
}