## Recording voltage across elements and using external stim Linear Circuit Builder

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

Moderator: hines

ckelley
Posts: 1
Joined: Wed Nov 18, 2020 3:04 pm

### Recording voltage across elements and using external stim Linear Circuit Builder

Hi, I was wondering if it's possible to record voltage across an element in the Linear Circuit Builder. I put together parallel RLC circuit connected to a battery and a current source, both of which are in turn connected to ground. I would like to record voltage of one of the elements, but when I create a New Graph, most of the options to plot are the current through those elements rather than voltage across them.

Also, I'm having some trouble setting up external stimulation for the current source. Tried playing a sinusoidal waveform into the current source (as hint suggests when clicking on "External Stim Pattern"), and the waveform gets stored in a separate vector, but it doesn't get plotted in the New Graph window. Setting up a step current through the GUI seems to work fine though.

Any advice would be much appreciated.

Thanks,
Craig
ted
Posts: 5897
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: Recording voltage across elements and using external stim Linear Circuit Builder

I was wondering if it's possible to record voltage across an element in the Linear Circuit Builder.
You can only record voltages relative to ground. If neither terminal of a two terminal device is grounded, you have to capture the time course of potential at each end into a pair of vectors, then after the simulation completes just subtract one vector from the other. Use the LCB's Name Map to discover the aliases for the variables of interest. For example, if Vi and Vo are the LCB's labels for opposite ends of a resistor, and the name map tells you

// name map:
// Vi Vector[5].x[0]
// Vo Vector[5].x[1]

then in hoc

objref tvec, vivec, vovec
tvec = new Vector()
tvec.record(&t)
vivec = new Vector()
vivec.record(&Vector[5].x[0])
vovec = new Vector()
vovec.record(&Vector[5].x[1])

In the particular instance of NEURON that I used to test this, it was necessary for at least one section to exist or else tvec.record(&t) failed with the error message "section access unspecified". So I created a section called dummy before setting up Vector.record, and that fixed the problem.
I'm having some trouble setting up external stimulation for the current source.
Strange, that worked OK for me. Maybe because I'm using a dummy section? In any case, I have a point process for a class Fzap that analytically calculates a swept sine waveform in the course of a simulation. Its parameters specify onset, duration, start and end frequency, and amplitude, and its output variable is a POINTER called x. I used this to drive the current delivered by a "B" (signal source) in series with the R of a parallel RLC circuit. Here's the hoc code

objref fz
fz = new Fzap()
fz.del = 10
fz.dur = 1000
fz.f0 = 10
fz.f1 = 10 // so it's just a 10 Hz sine wave
fz.amp = 1 // means 1 nA (i.e 2 nA peak to peak) to the LCB
setpointer fz.x, LinearCircuit[0].B

I'll email you the code and ses files etc. so you can play with this and maybe reimplement in Python if you like.