Hello,
I am looking to plot the function:
gnabar*m*m*m*h
These variables are all available in a model file HH.mod. Am I able to create a variable in my main .hoc file (Neuron.hoc) similar to:
gna = gnabar_HH*m_hh*m_hh*m_hh*h_hh
and plot it using either code or the NEURON GUI?
Or is it necessary to define and assign the variable gna in HH.mod and reference it as gna_HH? I have had no success trying to create an arbitrary variable in my .hoc file and plot it. Trying to learn what I can and can't do in NEURON.
Thanks!
 Tyler
EDIT: I was able to implement the above calculation inside HH.mod and plot it. However, my real reason in wanting to plot a variable from Neuron.hoc is so that I can try summing the gna from all .mod files and plot the result. Therefore I hope someone can still recommend a way of doing so. Thanks again!
Making and Plotting Arbitrary Variables

 Site Admin
 Posts: 5810
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Making and Plotting Arbitrary Variables
Presumably you have more than one NMODLspecified ionic current mechanism that WRITEs ina. If you want to know the sodium conductance associated with an instance of such a mechanism, it will be easiest for you if the mechanism's source code
{computes the conductance internally} AND {makes it available to hoc as a RANGE variable}
This means that the NEURON block declares
RANGE g : the sodium conductance
the ASSIGNED block declares
g (S/cm2) : for a density mechanism; units must be uS for a point process
and the BREAKPOINT block contains a statement of the form
g = formula_that_computes_conductance_density_of_open_sodium_channels
If you want to add up the total sodium conductance over the entire surface of the cell, you must also be concerned about units. This means multiplying the conductance associated with each instance of any given density mechanism by the surface area of the segment in which it exists, then scaling this product by whatever factor is necessary to ensure that the result has appropriate units. Conductances associated with any point processes that WRITE ina must also be calculated, scaled as necessary, and added to the sum in whatever segment to which they have been attached.
The simplest case is when the following statement is true:
{no point process WRITEs ina}
AND
{all density mechanisms that WRITE ina specify the channel density in S/cm2}
AND
{if a section contains one mechanism that WRITEs ina, it contains all mechanisms that WRITE ina}.
The total sodium conductance at any particular moment would then be returned by this function:
The right hand side of
for(x,0) sum += . . .
depends on the mechanisms that are used in your model.
To force calculation of a new value at every time step, it is necessary to define a new fadvance(). It will also be necessary to ensure that total conductance is calculated at initialization. Just make sure that this bit of codeis executed AFTER your model setup code but before run() is called. You will then be able to plot gnatotal or record it to a Vector during a simulation.
{computes the conductance internally} AND {makes it available to hoc as a RANGE variable}
This means that the NEURON block declares
RANGE g : the sodium conductance
the ASSIGNED block declares
g (S/cm2) : for a density mechanism; units must be uS for a point process
and the BREAKPOINT block contains a statement of the form
g = formula_that_computes_conductance_density_of_open_sodium_channels
If you want to add up the total sodium conductance over the entire surface of the cell, you must also be concerned about units. This means multiplying the conductance associated with each instance of any given density mechanism by the surface area of the segment in which it exists, then scaling this product by whatever factor is necessary to ensure that the result has appropriate units. Conductances associated with any point processes that WRITE ina must also be calculated, scaled as necessary, and added to the sum in whatever segment to which they have been attached.
The simplest case is when the following statement is true:
{no point process WRITEs ina}
AND
{all density mechanisms that WRITE ina specify the channel density in S/cm2}
AND
{if a section contains one mechanism that WRITEs ina, it contains all mechanisms that WRITE ina}.
The total sodium conductance at any particular moment would then be returned by this function:
Code: Select all
func totalgna() { local sum // returns total gna in S
sum = 0
forsec has_gna {
for (x,0) sum += (1e8)*area(x)*expression_that_sums_all_sodium_conductances_in_this_segment
}
return sum
}
for(x,0) sum += . . .
depends on the mechanisms that are used in your model.
To force calculation of a new value at every time step, it is necessary to define a new fadvance(). It will also be necessary to ensure that total conductance is calculated at initialization. Just make sure that this bit of code
Code: Select all
gnatotal = 0
proc advance() {
fadvance()
gnatotal = totalgna()
}
proc init_gnatotal() {
gnatotal = totalgna()
}
objref fih
fih = FInitializeHandler("init_gnatotal()")