waveform voltage commands

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

waveform voltage commands

Post by yemy »

hi,
as in the courses illustrated, using Vectorplay class, one can use arbitrary waveforms for voltage clamp. I checked the .ses file. The corresponding part contains the following codes. It reads the waveform data to build two vectors, and connects them to SEClamp. I am wondering, are there ways to achieve the same ends that in program one can switch different waveforms described in previously created vectors? or say, are there ways to assign vectors to se.dur1 and se.amp1 for waveform voltage commands or something like that?

Many thanks!

Code: Select all

//Begin VectorPlay[0]
{
load_file("vplay.hoc")
}
{
ocbox_=new VectorPlay(1)
}
{object_push(ocbox_)}
vy = new Vector(2001)
vx = new Vector(2001)
for i=0,2000 { vx.x[i]=fscan() vy.x[i]=fscan()}
0 -65
0.025 -65.1193
0.05 -65.2338
0.075 -65.344
0.1 -65.45
0.125 -65.552
0.15 -65.6504
0.175 -65.7452
0.2 -65.8367    // the rest data were omitted for clarity
{vy.plot(g, vx)}
{sname = "SEClamp6[0].amp1"  have_name = 1  contin = 0 con1(1)}
{object_pop()}
{
{
save_window_=ocbox_.g
save_window_.size(0,300,0,200)
scene_vector_[4] = save_window_
ocbox_.g = save_window_
save_window_.save_name("ocbox_.g")
}
ocbox_ = ocbox_.b
ocbox_.map("VectorPlay[0]", 1099, 398, 315, 286.2)
}
objref ocbox_
//End VectorPlay[0]

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

Re: waveform voltage commands

Post by ted »

That was a good idea, examining the ses file to see how it worked.

There are lots of ways to use Vector play. For very simple waveforms, it is easier to fill the Vectors with a few lines of hoc code. For example, this will generate a pair of Vectors that can be used to implement a ramp clamp with command potential that stays at v_init for the first BASELINEDUR ms, then sweeps up to v_init+RAMPAMP over the next RAMPDUR ms, after which it stays constant at v_init + RAMPAMP forever:

Code: Select all

BASELINEDUR = 10
RAMPDUR = 20
RAMPAMP = 20
objref tvec,vvec
tvec = new Vector(4)
vvec = new Vector(4)
tvec.x[0] = 0
vvec.x[0] = v_init
tvec.x[1] = BASELINEDUR
vvec.x[1] = v_init
tvec.x[2] = BASELINEDUR + RAMPDUR
vvec.x[2] = v_init + RAMPAMP
tvec.x[3] = BASELINEDUR + RAMPDUR + 1
vvec.x[3] = v_init + RAMPAMP
are there ways to achieve the same ends that in program one can switch different waveforms described in previously created vectors?
There are many different ways you could do this. If you have some simple waveforms in mind, the easiest way is to just go ahead and set up Vector play so that there is a pair of Vectors called vvec and tvec that will control the SEClamp's command potential. Then use a procedure that resizes vvec and tvec and fills them with the desired waveform information. Example:

Code: Select all

RAMPDUR = 20
RAMPAMP = 20
proc setramp() {
  tvec.resize(4)
  vvec.resize(4)
  tvec.x[0] = 0
  vvec.x[0] = v_init
  tvec.x[1] = BASELINEDUR
  vvec.x[1] = v_init
  tvec.x[2] = BASELINEDUR + RAMPDUR
  vvec.x[2] = v_init + RAMPAMP
  tvec.x[3] = BASELINEDUR + RAMPDUR + 1
  vvec.x[3] = v_init + RAMPAMP
}

proc setsomethingelse() {
  tvec.resize(somenumber)
  vvec.resize(somenumber)
  tvec.x[0] = 0
  vvec.x[0] = v_init
  tvec.x[1] = whatever comes next
  vvec.x[1] = ditto
  . . . until the waveform is complete . . .
}
Then you simply call one of these procedures and it fills vvec and tvec with the waveforms you want.

Alternatively, you could save the t and v values in a set of files, and use procedures that read these values into vvec and tvec as necessary. This would work well with experimental data, e.g. experimentally recorded psp or psc waveforms.

For stereotyped waveforms, such as repetitive pulses or sine waves or zap functions, it is best to use a mod file that generates a voltage or current waveform with the desired properties.

A final comment: instead of using VClamp, I suggest that you use SEClamp--see
Use SEClamp instead of VClamp
in the Hot tips area of the Forum
viewforum.php?f=28
yemy

Re: waveform voltage commands

Post by yemy »

hi, Ted, thank you for your detailed reply. My resting major concern is how to connect vectors(eg. read from experimentally recorded waveforms) to SEClamp[0].amp1 and dur1 at the hoc level (for this end, not in Vectorplay GUI).

I was reading the programmer reference on the usage of vector play. But not very sure how to use the play function correctly for arbitrary waveform clamp:

vvect.play(&SEClamp[0].amp1,tvec)

vsrc.play(point_process_object, &var, ...)
fadvance()


if there is an example hoc file that would be very much clear.
eg. a ball model inserted with hh. The vectors could be a spike waveform generated in Neuron7.1 or tvec and vvec as you shown previously. Point process is SEClamp
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: waveform voltage commands

Post by ted »

yemy wrote:I was reading the programmer reference on the usage of vector play. But not very sure how to use the play function correctly for arbitrary waveform clamp
Look on the Documentation page of http://www.neuron.yale.edu/ for the link to NEURON's FAQ list. In the FAQ list, look for this item:
SEClamp and IClamp just deliver rectangular step waveforms. How can I make them produce an arbitrary waveform, e.g. something that I calculated or recorded from a real cell?
yemy

Re: waveform voltage commands

Post by yemy »

Thank you, Ted. I have figured it out. Just test "vvec.play(&var,tvec)" and run the simulation.
Post Reply