change the onset time of voltage clamp

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Ziling Wang
Posts: 8
Joined: Mon Mar 25, 2024 2:45 am

change the onset time of voltage clamp

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))
ted
Posts: 6322
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: change the onset time of voltage clamp

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?
Ziling Wang
Posts: 8
Joined: Mon Mar 25, 2024 2:45 am

Re: change the onset time of voltage clamp

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.
ted
Posts: 6322
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: change the onset time of voltage clamp

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?)