Skip to content

Custom Electrode Configurations

Joey Kilgore edited this page Aug 12, 2019 · 5 revisions

Warning!

The ability to create any electrode configuration requires the user to have a full understanding of what is actually happening in the simulation. It is recommended you go through each of the model files associated with the electrodes you plan to use and understand them fully. All of the following documentation is meant to be used directly through the command line. You have been warned.

Overview

Using the electrode_controller.hoc procs we can create any electrode setup. Electrodes are created using the Electrode template found in the electrode_object.hoc file. The electrode template functions as a way to treat all electrode types equally. The electrodes are stored in the electrodes[100] array. Creating electrodes adds them to the array, and removing them takes them out of the array. As you build your custom configuration you will be able to access the direct parameters of the electrode by using the standard dot syntax and accessing any variables you need to set.

Understanding the electrodes[100] array and availableElectrodes[100]

To have the ability to create and delete electrodes as necessary, some basic data structures knowledge was used. The methodology used here was having availableElectrodes[100] function as the pointers to form two singly linked lists. One list contained all the currently used electrodes, and the other contained the list of all unused indices in electrodes[100].


Electrode Controller Procs

turnOnCustomElectrodes()

Sets the simulation environment to use the custom electrode setups instead of the standard electrodes.

turnOffCustomElectrodes()

Sets the simulation environment to use the standard electrode setup instead of the custom one.

outputElectrodeSetup()

This method will be useful in finding which indices were used for which electrodes. The indices are needed when calling other methods, or accessing the electrode directly.

saveElectrodeConfig()

Save the current electrode configuration to a config.ses file. This can then be loaded at a later time through NEURON by simply loading the .ses file (In NEURON Main Menu click File -> Load Session).

createElectrode(type, xpos, ypos)

Creates a new electrode which is added into the next available position in the electrodes[100] array. The type is an integer which corresponds to the electrode you would like to create:
0 - Sine Wave
1 - Triangle Wave
2 - Square Wave
3 - Sine Ramp*
5 - Direct Current
*Sine ramp is not supported by many of the functions for setting amplitude and other parameters. Requiring the user to set the actual parameters on the electrode itself which can be found in SineRamp.mod file
The xpos and ypos are the x position and y position the electrode will be located relative to the center of the axon. The units are in um which means placing the electrode at (0,1000) will be 1mm above the center electrode.

removeElectrode(indexOfElectrode)

This will remove the electrode at the specified index. Use the outputElectrodeSetup() proc to check which index each electrode is located at.

setExtracellular()

Sets the appropriate extracellular voltage for the entire axon given the current electrode setup.

setAmplitudeElectrodes(amplitude)

Sets the amplitude of all electrodes currently used in the setup to the passed value. The amplitude is in nA.


Electrode Template

These procs and variables are available to the user using the . syntax on the appropriate electode. To access the a specific electrode and the model parameters use electrodes[index].electrodeModel

electrodeModel

This is a public object within the Electrode object. Use this for accessing the model directly.

calcVoltage(x,y)

Calculates the voltage a particular point. X and Y are relative to the center of the axon. This returns the voltage that the electrode would create at that point at the specific time the func is called.

calcVoltageCompartment(index)

Calculates the extracellular voltage for a specific compartment. This is an improved version of calcVoltage() because the majority of the calculation is done ahead of time and stored in ext.

setPos()

This does the calculations ahead of time that are used to speed up calcVoltageCompartment()
It optionally can be passed 2 arguments setPos(newX, newY) which changes the position of the electrode to the passed values.

movPos(changeX, changeY)

This will allow the user to move the electrode the specified amount in the x and y direction. This will also call setPos() and update the calculations needed for calcVoltageCompartment()

setAmp(amplitude)

Set the amplitude of the electrode. This is supported by the sine, triangle, square, and DC electrode (types = 0,1,2,5 respectively). The amplitude is in nA.

setFreq(frequency)

Set the frequency of the electrode. This is supported by the sine, triangle, square electrodes (types = 0,1,2 respectively). The frequency is in Hz.

setDur(duration)

Set the duration of the electrode. This is supported by sine, triangle, square, and DC electrodes (types 0,1,2,5 respectively). the duration is in ms.

setDel(delay)

Set the delay of the electrode. This is supported by sine, triangle, square, and DC electrodes (types 0,1,2,5 respectively). the delay is in ms.

oppPolarity()

Sets the electrode to have the opposite amplitude values given to it. This is used when having multiple electrodes of opposite polarity when doing block threshold calculations. Because the BT tests automatically set all electrodes to the same amplitude, using this they will get set to opposite polarity. Calling this method a second time will turn the polarity back to normal.

getAmp()

Returns the amplitude of the electrode (in nA).

getFreq()

Returns the frequency of the electrode (in Hz).

getDur()

Returns the duration of the electrode (in ms).

getDel()

Returns the delay of the electrode (in ms).

getXPos()

Returns the X position of the electrode (in um).

getYPos()

Returns the Y position of the electrode (in um).

getModelNum()

Returns the model number corresponding to what type of electrode model is used. See createElectrode above.

printData()

Output data about the electrode. Includes the index, model, and position.

printDataAdvanced()

Output data about the electrode. Includes the index, model, position, amplitude, frequency, duration, and delay.