Page 1 of 1

change the onset time of voltage clamp

Posted: Fri Jul 12, 2024 1:44 am
by Ziling Wang
I am simulating a neural dynamic when it receives a synaptic input at t=0. And I want to insert a voltage clamp into the soma with different onset

times. How can I change the start time of a somatic voltage clamp when using SEClamp?


# Initialize voltage clamp
vclamp = h.SEClamp(L5PC.soma[0](0.5))

Re: change the onset time of voltage clamp

Posted: Fri Jul 12, 2024 10:32 am
by ted
I am simulating a neural dynamic when it receives a synaptic input at t=0.
An important concern in any experiment, whether on a living cell or a computational model, is the initial state of the system (cell or model) before any stimulus or perturbation is applied. If it is not in a resting state at t==0, how will you know if its behavior over time is caused by the stimulus/perturbation? This is why wet-lab experimentalists often include a short interval in their recordings starting at t==0 when no stimulus is applied, to demonstrate that the system was at rest. You should do the same in your computational experiment. Computational models are often not properly initialized.
And I want to insert a voltage clamp into the soma with different onset times.
You mean you want the cell to be unclamped at t == 0, and then be clamped starting at some time t1 > 0?

Re: change the onset time of voltage clamp

Posted: Sun Jul 14, 2024 10:55 pm
by Ziling Wang
Yes, the computational model is at the resting state at time t = 0, and it also receives a synaptic input at t=0. Then, we attempt to insert a somatic

voltage clamp, for example at t=5ms.

Re: change the onset time of voltage clamp

Posted: Mon Jul 15, 2024 12:19 pm
by ted
Two recommendations.

1. For the reasons mentioned above, don't activate the synapse at 0 ms. Instead, let the model execute for at least 1 ms before activating the synapse.

2. Use an FInitializeHandler (default type is good for this) to do two things during model initialization:
(1) set the SEClamp's rs to 1e9 megohms
(2) use cvode.event() to change rs to a small value, e.g. 0.01 megohms, at the time when you want to clamp the cell

Be sure to read the documentation of FInitializeHandler and cvode.event at nrn.readthedocs.io

Example that assumes existence of an SEClamp with Python name sec:

Code: Select all

t1 = 5 # when to clamp the cell

def setup(ton):
  sec.rs = 1e9 # decouples clamp from the model cell
  h.cvode.event(ton, activateclamp) 

def activateclamp():
  sec.rs = 0.01 # couples clamp to the model cell

fih = h.FinitializeHandler(setup(t1)) # executes setup(t1) every time finitialize() is called
This requires an instance of CVode to exist--and that instance will exist if you either [imported not only h but also gui] OR [executed h.load_file("stdrun.hoc")]

Don't forget to make sure that sec.dur1 is > t1 (why?)