Are there any outdated hoc codes?

Anything that doesn't fit elsewhere.
Post Reply
nianwosuh
Posts: 39
Joined: Tue Jul 27, 2010 11:00 pm

Are there any outdated hoc codes?

Post by nianwosuh »

I'm going through some of Destexhe models, when I double clicked on his hoc code to run it as to see what the out puts of the models are I get error messages like :

graphList not an array variable
in /cygdrive/C/Documents and Settings/_Irene_/My Documents/Research at WFUMC/Peer review papers/Destexhe_moedels/Dextche_Synapses/GABA_B_Receptor/gabaa.hoc near line 46
graphList[0].append(g[ii])

I looked up for "graphList" on the on-line help file (Programmers' reference manual), I did not find this term"graphList"

I commented out the lines that have "graphList[0].append(g)" and and tried to run it by double clicking on the model again it generated another error;
" nrniv: nrnmainmenu undefined function
in /cygdrive/C/Documents and Settings/_Irene_/My Documents/Research at WFUMC/Peer review papers/Destexhe_moedels/Dextche_Synapses/GABA_A_Receptor/gabaa2.hoc near line 54
}
^
nrnmainmenu( )"

I looked up for "nrnmainmenu" and could not find it again.

I added the "load_file("nrngui.hoc")" at the beginning of the his program, and opened the model by double clicking on it, this time there was no error, it opened with graphs and the Run Control button, but when I pressed the run button, there was no graph generated on any of the graphs, so I guess that might be related to the "graphList[0]" which I had commented out.

My question then is, are there old codes in hoc that are no longer conpartible with the current version of NEURON? and if there are what are the current equivalents?

Looking at Destexhe programs he did everything by "brute method" confirming what you said earlier that he begin using NEURONin its embroyonic stage

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

Re: Are there any outdated hoc codes?

Post by ted »

Your post raises a lot of interesting issues.
I looked up for "graphList" on the on-line help file (Programmers' reference manual), I did not find this term"graphList"
I should point out that the Programmer's Reference only contains definitions of hoc keywords. If something is not a hoc keyword, you probably won't find it discussed in the Programmer's Reference. For example, graphList is not a hoc keyword, so it's not in the Programmer's Reference.

To which you might very well reply "Where do these strange names come from, and how can I learn more about them?"

Things that look like keywords but are not found in the NEURON Programmer's Reference are either the names of variables or procedures defined by user-written hoc code or NMODL code, or they are defined by hoc code in a collection of files known as NEURON's "hoc library." The hoc library is discussed in Secrets of NEURON: the hoc library, which is a discussion thread in the "Hot tips" area of the NEURON Forum--see viewforum.php?f=28.

An important part of the hoc library is the standard run system, which controls what happens in the course of a simulation. One of the things that happens during a simulation is the updating of graphs, and this is where the graphLists come in. As you will see near the end of chapter 7 of The NEURON Book, if a graph is appended to one of the graphLists, it will be updated automatically in the course of a simulation. There are four graphLists, but the three that are most commonly used are the first three (graphlist[0]...graphlist[2]), whose member graphs are updated at t, t-0.5*dt, and t+0.5*dt, respectively.
nianwosuh wrote:I'm going through some of Destexhe models, when I double clicked on his hoc code to run it as to see what the out puts of the models are I get error messages like :

graphList not an array variable
in /cygdrive/C/Documents and Settings/_Irene_/My Documents/Research at WFUMC/Peer review papers/Destexhe_moedels/Dextche_Synapses/GABA_B_Receptor/gabaa.hoc near line 46
graphList[0].append(g[ii])
This tells me that NEURON encountered the name "graphList" in some hoc statement and didn't know what it meant. Since graphLists are defined by code in the standard run library, NEURON doesn't have a clue about graphLists until after it reads the standard run library.

Under Linux, which Destexhe and many of his collaborators use, it is common to start NEURON from the command line by typing something like
nrngui yourprogram.hoc
where yourprogram.hoc is the name of a user-written hoc file, and nrngui is a command that launches NEURON and makes it read a bunch of hoc code that includes, among other things, the standard run library--and after it does all that, NEURON finally gets around to reading . But under MSWin, if you double click on a hoc file, NEURON starts and it reads yourprogram.hoc, period. Doesn't bother to read the standard run library. That's why you're getting an error message about graphList.

There are at least two ways to deal with this problem.

One way is to start nrngui first, by double clicking on the nrngui icon in the NEURON Program Group (this makes NEURON start and read a bunch of files that include the standard run library, just like the Linux command "nrngui" does). Then use
NEURON Main Menu / File / load hoc
to navigate to the directory where yourprogram.hoc is located, select yourprogram.hoc, and finally click on "Accept".

A more practical solution is to insert the statement
load_file("nrngui.hoc")
as the first line in every hoc program, as you did. This ensures that users can double click on this hoc file, or use the command line
nrngui yourprogram.hoc
and NEURON will read the standard run library before reading yourprogram.hoc
I commented out the lines that have "graphList[0].append(g)" and and tried to run it by double clicking on the model again it generated another error;
" nrniv: nrnmainmenu undefined function
. . .
I looked up for "nrnmainmenu" and could not find it again.
Yes, because the nrnmainmenu toolbar is created by code that is part of NEURON's standard run library. Same cause as the graphList problem, and same cure.
I added the "load_file("nrngui.hoc")" at the beginning of the his program, and opened the model by double clicking on it, this time there was no error, it opened with graphs and the Run Control button, but when I pressed the run button, there was no graph generated on any of the graphs, so I guess that might be related to the "graphList[0]" which I had commented out.
You pretty much figured it out. The graphs remained blank because they were not updated during the simulation. They were not updated because they were not appended to graphList[0].

You might find this to be revealing: use the CellBuilder to make a simple model cell, then use
NEURON Main Menu / Graph / Voltage axis
to create a new graph, then save this graph to a session file, and finally examine the session file. You'll see a few lines of what looks like gibberish, then all of a sudden this:

Code: Select all

save_window_ = new Graph(0)
save_window_.size(0,5,-80,40)
 . . .
{save_window_.view(0, -80, 5, 120, 130, 105, 300.48, 200.32)}
graphList[0].append(save_window_)
 . . .
save_window_.addexpr("v(.5)", 1, 1, 0.8, 0.9, 2)
So you see the statements that
create a graph
specify its axis scaling, xy position, and size on the computer screen
append it to one of the graphLists
and--at last--
specify the name of the variable that it will plot

You might also find this interesting:
How to use hoc to plot a variable vs. time
viewtopic.php?f=30&t=552
especially the section entitled
Stealing code from a session file
nianwosuh
Posts: 39
Joined: Tue Jul 27, 2010 11:00 pm

Re: Are there any outdated hoc codes?

Post by nianwosuh »

Thank you very much for these detailed explanations, and for the links you included , the information there have demystified many codes that I find overwhleming, wondering what they mean and how people could figure such details out.

Thank you very much!
Irene
Post Reply