arbor icon indicating copy to clipboard operation
arbor copied to clipboard

Voltage clamps

Open halfflat opened this issue 4 years ago • 7 comments

We have requests for voltage clamps!

espenhgn commented on Dec 1, 2020 Please add a feature for voltage clamps which allows for arbitrary long sequences of piece-wise constant holding potentials as well.

and

Sebastian Schmitt Can I clamp the voltage in a CV?

For now, this is a placeholder issue; will expand with requirements and implementation options later.

halfflat avatar Feb 04 '21 12:02 halfflat

In terms of how we treat it, is it better to:

  • pin the voltage as part of the model, that is, effectively change the maths so that the voltage on the corresponding CV is (piecewise) constant? or,
  • model the clamp as a current injection that attempts to mimic an actual experimental voltage clamp?

While so far we have been thinking primarily in terms of clamping at a point, is there a need for clamping whole sections of the cell membrane across the morphology?

halfflat avatar Mar 03 '21 09:03 halfflat

Hi @halfflat. I think to mimic the experimental voltage clamp setup as a dynamic current injection in a point make more sense, that is, see more use in order to mimic in vitro and in vivo experiments where neurons are held at some voltage (to negate effects from particular channels, synapse types etc.) while also recording the stimulation current. Haven't actually tried; could very well be that the .mod file for NEURON's SEClamp mechanism can be modified for use with Arbor already: https://github.com/neuronsimulator/nrn/blob/5feec9097814717d159225ddcdfb7bb8ab31f36a/src/nrnoc/svclmp.mod.

There's also a VClamp mechanism (https://github.com/neuronsimulator/nrn/blob/5feec9097814717d159225ddcdfb7bb8ab31f36a/src/nrnoc/vclmp.mod) which accounts for some properties of the amplifier stage.

That's not to say the first suggestion is without use cases, I'm aware of at least one study (Pettersen and Einevoll, 2008, https://doi.org/10.1529/biophysj.107.111179) which imposed some voltage trace as a compartment voltage boundary condition in order to compute resulting transmembrane current distributions without actually incorporating HH type formalism in the otherwise passive cable model. I think this use case if perhaps of lesser interest for typical users of Arbor - and could anyway be well approximated by a voltage clamp mechanism that allows using an arbitrary voltage trace as input.

espenhgn avatar Mar 03 '21 12:03 espenhgn

Thanks, @espenhgn! Implementing something like svclmp would be straightforward, I believe, within the library proper (i.e. not as a mechanism). Perhaps this should be our first target, to be expanded upon later as required?

halfflat avatar Mar 04 '21 11:03 halfflat

Hi. Mimicking svclamp one way or the other seems like a good step forward indeed. It also seems to be preferable over the other VClamp mechanism: https://www.neuron.yale.edu/neuron/faq#faq-What-is-the-difference-between-SEClamp-and-VClamp,-and-which-should-I-use?

My only concern about bringing the functionality directly over would be play back of arbitrary traces, like so in NEURON (note that I chose a coarser time resolution for the clamp voltage):

import numpy as np
import matplotlib.pyplot as plt
import neuron

# sim parameters
T = 100
dt = 0.1
# create passive "cell"
sec = neuron.h.Section(name='sec')
sec.insert('pas')

# define voltage clamp trace
t = np.arange(100.)
v = np.zeros_like(t)
v[10:90] = 50*np.sin(0.5*t[10:90])
v += sec(0.5).e_pas
v = neuron.h.Vector(v)
# create vclamp device
vclamp = neuron.h.SEClamp(sec(0.5))
vclamp.rs = 1E-3  # series resistance << cell input impedance
vclamp.amp1 = sec(0.5).e_pas  # avoid startup current transient
vclamp.dur1 = 1E9

# play back into reference amplitude
v.play(vclamp._ref_amp1, 1.)

# record some variables
I = neuron.h.Vector()
Vsec = neuron.h.Vector()
tvec = neuron.h.Vector()

I.record(vclamp._ref_i, dt)
Vsec.record(sec(0.5)._ref_v, dt)
tvec.record(neuron.h._ref_t, dt)

# run simulation
neuron.h.dt = dt
neuron.h.finitialize(sec(0.5).e_pas)
neuron.run(T)

# plot
fig, ax = plt.subplots(3, 1, sharex=True, figsize=(8, 8), dpi=120)
ax[0].plot(t, v)
ax[1].plot(tvec, I)
ax[2].plot(tvec, Vsec)
for i, lbl in enumerate(['$V_\mathrm{clamp}$ (mV)', r'$I_\mathrm{clamp}$ (nA)', '$V_\mathrm{sec}$ (mV)']):
    ax[i].set_ylabel(lbl)

image

espenhgn avatar Mar 05 '21 09:03 espenhgn

@espenhgn We're trying to plan out our work for the coming Arbor releases (we're in our first dev meet right now :) https://arbor-sim.org/news/). Could you comment on how urgently you need this, or is it just a nice-to-have-one-day?

brenthuisman avatar Nov 24 '21 10:11 brenthuisman

Hi @brenthuisman; This is not something I need immediately.

espenhgn avatar Nov 24 '21 11:11 espenhgn

#1841 could be extended to allow for voltage clamps.

schmitts avatar Mar 08 '22 10:03 schmitts