first step in neuron

The basics of how to develop, test, and use models.
Post Reply
reza_rzm
Posts: 34
Joined: Tue Aug 23, 2005 10:07 am

first step in neuron

Post by reza_rzm »

Dear Friends,

I'm a new user of Neuron. i would like to have your advice to

(i have downloaded toturial fron wbsite, include sthA.hoc,...)
(i'm using winXP)

1- how can i run a code from "nrngui"?

2- to see and do modification on code i open it by Microsoft Word, and for run it again , i close previous "Neuron main Menu",and double click on my modification code.I feel, it should be another way to do that,could you please tell me what are you doing?


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

Re: first step in neuron

Post by ted »

Good questions.
(i have downloaded toturial fron wbsite, include sthA.hoc,...)
(i'm using winXP)

1- how can i run a code from "nrngui"?
Since you're using MSWin, all you have to do is double click on a hoc file.
No need to mess with the command line. You may find it useful to read
some of the stuff in the FAQ list--on NEURON's Documentation page
http://www.neuron.yale.edu/neuron/docs
click on the item called
FAQ
2- to see and do modification on code i open it by Microsoft Word, and for run it again , i close previous "Neuron main Menu",and double click on my modification code.I feel, it should be another way to do that,could you please tell me what are you doing?
OK, you already know about double clicking on hoc files. Excellent.

MicroSoft Word may not be the worst thing to use to write program code, but it's close.
Like using a 747 as a kite. There are plenty of text editors that are much faster and
more convenient, and many of them are completely free. I use the free version of
NoteTab, which takes up very little disk space, almost no RAM, and is smart enough
to be able to read and write Mac, UNIX/Linux, and DOS text files (important since
you'll find NEURON code that has been developed in all three environments). It's
extremely easy to use. One particularly nice feature: you can have several different
files open at the same time, and switch between them by clicking on tabs. You'll find
NoteTab at www.notetab.com, and remember, the free version is perfectly fine for
developing programs.
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Hanze University of Applied Sciences
Contact:

Editors with Syntax Highlighting

Post by Raj »

Just to offer you another option, which also has tabs but with which I can offer syntax highlighting of hoc and mod language reserved words.

Creditor:
http://www.praven3.com/credit/

Just install CREditor and save the following as CREditHgl.INI in the directory where you installed/unpacked CREditor.

Code: Select all

[hoc]
Active=Yes
Extension=.hoc,.ses,.tem
CaseSensitive=1
CharDelimiter='
EOLComment1=//
EOLComment2=
FirstCommentChar=
HTMLDelimiters=
MLComment=/*  */
Operators=
PreprocessorChar=#
StringDelimiter="
StringEscape=
Keywords=abs;access;arc3d;area;atan;begintemplate;break;connect;continue;cos;create;debug;Deck;define_shape;DEG;delete;delete_section;depvar;diam;diam_changed;diam3d;disconnect;distance;double;E;else;em;endtemplate;eqn;erf;erfc;exp;external;FARADAY;File;
Keywords1=float_epsilon;for;forall;forsec;fprint;fscan;func;getSpineArea;getstr;Glyph;Graph;GUIMath;HBox;help;hoc_ac_;hoc_cross_x_;hoc_cross_y_;hoc_obj_;hoc_stdio;if;ifsec;init;insert;int;iterator;iterator_statement;L;List;load_file;load_func;load_proc;local;log;
Keywords2=log10;Matrix;n3d;new;nseg;numarg;object_id;object_pop;object_push;objectvar;objref;PHI;PI;Pointer;pop_section;print;print_session;printf;proc;pt3dadd;pt3dchange;pt3dclear;pt3dconst;pt3dinsert;pt3dremove;public;push_section;R;Ra;Random;read;return;ri;
Keywords3=ropen;setpointer;setSpineArea;sin;solve;spine3d;sprint;sqrt;sred;sscanf;startsw;stop;stopsw;strcmp;strdef;StringFunctions;symbols;SymChooser;system;tanh;topology;uninsert;units;unref;ValueFieldEditor;variable_domain;VBox;Vector;while;wopen;x3d;xopen;xred;
Keywords4=y3d;z3d;
ColorString=00808000
ColorPreprocessor=00002AA5
ColorNumber=00000000
ColorComment=00009300
ColorOperator=0000FFFF
ColorKeyword=00FF0000


[mod]
Active=Yes
Extension=.mod
CaseSensitive=1
CharDelimiter="
EOLComment1=:
EOLComment2=
FirstCommentChar=
HTMLDelimiters=
MLComment=COMMENT ENDCOMMENT
Operators=
PreprocessorChar=#
StringDelimiter="
StringEscape=
Keywords=ARTIFICIAL_CELL;ASSIGNED;at_time;b_flux;BREAKPOINT;BY;celsius;cnexp;COMPARTMENT;CONSERVE;CONSTANT;cvode;DEFINE;DEPEND;DERIVATIVE;derivimplicit;diam;dt;ELECTRODE_CURRENT;else;ENDVERBATIM;extracellular;f_flux;fadvance;fcurrent;forall;FROM;FUNCTION;
Keywords1=FUNCTION_TABLE;GLOBAL;if;INDEPENDENT;INITIAL;ion_style;KINETIC;LINEAR;LOCAL;LONGITUDINAL_DIFFUSION;METHOD;net_event;NET_RECEIVE;net_send;NetCon;NEURON;NONLINEAR;NONSPECIFIC_CURRENT;PARAMETER;POINT_PROCESS;POINTER;PROCEDURE;RANGE;re_init;READ;RestoreState;
Keywords2=SaveState;setdata_;setpointer;SOLVE;STATE;state_discontinuity;STEADYSTATE;SUFFIX;t;TABLE;table_;threshold;TITLE;TO;UNITS;UNITSOFF;UNITSON;USEION;v;v_init;VERBATIM;vext;WITH;WRITE;
ColorString=00808000
ColorPreprocessor=00002AA5
ColorNumber=00000000
ColorComment=00009300
ColorOperator=0000FFFF
ColorKeyword=00FF0000
If you now open a file which ends in .hoc,.ses,.tem, .mod with CREditor it will show comments in green, reserved words in blue, strings in bluegreen.

If you find omissions or errors in the syntax highlighting send me a private message and I'll update this post.


PS. If you like emacs you might try David Sterrats syntax highlighting:
http://www.anc.ed.ac.uk/~dcs/progs/neuron/. If you don't know about emacs, you better forget about it for now.


Edits:
02-Nov-2005 Added iterator_statement to hoc keywords
eacheon
Posts: 97
Joined: Wed Jan 18, 2006 2:20 pm

Post by eacheon »

I am wondering will someone contribute a VIM syntax file for hoc
files? I am using one modified from java.vim but still hope for a
better one...
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Hanze University of Applied Sciences
Contact:

PSPad

Post by Raj »

I earlier introduced Creditor to this forum. Creditor however is no longer
maintained although still available. So for people who like to see things
move forward,like support for Python and many more good things there is
a good alternative in PSPad. PSPad lacks two or three features I liked in
Creditor, like strings being treated as file name, so you could quickly
jump from hoc file to hoc-file, but PSPad seems to have a future. PSPad
has many more then compensating extra's not available in Creditor, e.g.
launching Neuron from within your editor and project support.


http://www.pspad.com/

Some initial syntax files:
For HOC, save as NEURON.INI in Syntax directory PSPad. Then goto
Settings->Highlighter Settings and select one of the <not> fields
and then select NEURON from the list at the right. Among the userhighlighters
there should now be NEURON, chech the box in front of it and you should
be in business.

Code: Select all

;PSPad user HighLighter definition file
[Settings]
Name=NEURON
HTMLGroup=0
FileType=*.hoc,*.ses,*.tem
CommentString=//
SlashComment=1
CComment=1
SlashComment=1
IndentChar={
UnIndentChar=}
TabWidth=0
CaseSensitive=1
SingleQuote=1
DoubleQuote=1
KeyWordChars=_
CodeExplorer=ftUnknown
[KeyWords]
; Core hoc-language
break=
else= 
insert= 
stop= 
continue= 
em=
strdef= 
debug= 
eqn= 
print= 
uninsert= 
delete=
for= 
read= 
while= 
depvar= 
help= 
return= 
double=
if= 
setpointer= 
proc= 
func=
obfunc=
local=
localobj= 
iterator=
; Object-oriented-programming
begintemplate= 
init= 
objref= 
endtemplate= 
new=
public= 
external= 
objectvar= 
unref=
; Section stuff: neuron/geometry.html
access= 
forsec= 
pop_section=
forall= 
ifsec= 
push_section=
diam3d= 
pt3dchange= 
setSpineArea=
pt3dclear= 
spine3d=
arc3d= 
distance= 
pt3dconst= 
x3d=
area= 
getSpineArea= 
pt3dinsert= 
y3d=
define_shape= 
n3d= 
pt3dremove= 
z3d=
pt3dadd= 
ri=
connect= 
delete_section=
create= 
disconnect= 
topology=
[ReservedWords]
; Built-in variables: neuron/geometry.html
L=
Ra= 
diam= 
nseg= 
diam_changed=
; Built-in global variables: neuron/1nrn.html#globals
celsius= 
dt= 
t= 
clamp_resist= 
secondorder=
;Physical and Mathematical Constants 
DEG=
E=
FARADAY=
GAMMA=
PHI=
PI=
R=
float_epsilon=

[KeyWords2]
; Functions
attr_praxis=
fit_praxis=
nrnmechmenu= 
secname= 
batch_run= 
fmatrix= 
nrnpointmenu= 
section_orientation=
batch_save= 
fstim= 
nrnsecmenu= 
sectionname=
fadvance= 
fstimi= 
parent_connection= 
stop_praxis=
fclamp= 
hocmech= 
parent_node= 
this_node= 
fclampi= 
initnrn= 
parent_section= 
this_section=
fclampv= 
ismembrane= 
prstim=
fcurrent= 
issection= 
psection=
finitialize= 
nrnglobalmechmenu= 
pval_praxis=
fprint= 
hoc_stdio= 
sred= 
xred=
fscan= 
printf= 
wopen=
getstr= 
ropen= 
xopen=
doEvents= 
doNotify=
hoc_ac_=
hoc_cross_x_=
hoc_cross_y_=
hoc_obj_=
hoc_pointer_= 
object_pop= 
sprint=
ivoc_style= 
object_push= 
sscanf=
allobjects= 
load_file= 
obsolete= 
startsw=
allobjectvars= 
load_func= 
print_session= 
stopsw=
chdir= 
load_proc= 
prmat= 
stopwatch=
checkpoint= 
load_template= 
pwman_place= 
strcmp=
coredump_on_error= 
machine_name= 
quit= 
symbols=
dialogs= 
math= 
retrieveaudit= 
system=
eqinit= 
name_declared= 
save_session= 
units=
execute= 
neuronhome= 
saveaudit= 
variable_domain=
execute1= 
numarg= 
show_errmess_always=
getcwd= 
object_id= 
solve=
; Mathematical functions
abs=
cos=
erf=
erfc=
exp=
int=
log=
log10=
sin=
sqrt=
tanh=


[KeyWords3]
;Built in classes
Deck=
File=
Glyph=
Graph=
GUIMath=
HBox=
List=
Matrix=
Pointer=
Random=
StringFunctions=
SymChooser=
ValueEditor=
ValueFieldEditor=
VBox=
Vector=
For mod, save as NMODL.INI in Syntax directory PSPad.

Code: Select all

;PSPad user HighLighter definition file
[Settings]
Name=NMODL
HTMLGroup=0
FileType=*.mod
CommentString=
PerCentComment=1
IndentChar={
UnIndentChar=}
TabWidth=4
CaseSensitive=1
DoubleQuote=1
KeyWordChars=-_
CodeExplorer=ftUnknown
[KeyWords]
ARTIFICIAL_CELL=
ASSIGNED=
at_time=
b_flux=
BREAKPOINT=
celsius=
cnexp=
COMPARTMENT=
CONSERVE=
CONSTANT=
cvode=
DEFINE=
DEPEND=
DERIVATIVE=
derivimplicit=
diam=
dt=
ELECTRODE_CURRENT=
else=
ENDVERBATIM=
extracellular=
f_flux=
fadvance=
fcurrent=
forall=
FROM=
FUNCTION=
FUNCTION_TABLE=
GLOBAL=
if=
INDEPENDENT=
INITIAL=
ion_style=
KINETIC=
LINEAR=
LOCAL=
LONGITUDINAL_DIFFUSION=
METHOD=
NET_RECEIVE=
net_event=
net_send=
NEURON=
NONLINEAR=
NONSPECIFIC_CURRENT=
PARAMETER=
POINT_PROCESS=
POINTER=
PROCEDURE=
RANGE=
re_init=
READ=
setdata_=
setpointer=
SOLVE=
STATE=
state_discontinuity=
STEADYSTATE=
SUFFIX=
TABLE=
table_=
TITLE=
TO=
UNITS=
UNITSOFF=
UNITSON=
USEION=
VERBATIM=
WITH=
WRITE=
[ReservedWords]
t=
v=
v_init=
vext=
[KeyWords2]
NetCon=
RestoreState=
SaveState=
[KeyWords3]
May 20 2006: NEURON.INI Compared with David Sterrats syntax highlighting for emacs and updated accordingly.
Last edited by Raj on Mon Nov 13, 2006 8:29 am, edited 6 times in total.
Eric Thomson
Posts: 15
Joined: Thu Mar 02, 2006 11:18 am
Contact:

Post by Eric Thomson »

How can I activate this syntactic highlighter?

I have saved NEURON.INI in the Syntax folder, but when I go to View-->Change Syntax, NEURON does not come up as an option. I haven't found any instructions in PSPad's help files.

Added in Edit:
Note for those who want to do this: the new .ini file appears at the BOTTOM of the (putatively) alphabetized list of .ini files (i.e., Neuron appeared after Z80), so be sure to scroll down. I missed it loitering there at the bottom.
Last edited by Eric Thomson on Fri Mar 17, 2006 4:46 pm, edited 1 time in total.
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Hanze University of Applied Sciences
Contact:

Post by Raj »

I updated the original posting, the DEF files are not needed.
davidsterratt
Posts: 28
Joined: Tue Jan 17, 2006 11:36 am

Nmodl mode for emacs

Post by davidsterratt »

Hello syntax highlighters of an emacs persuasion,

it was suggested to me that I post my new nmodl mode for emacs here as well as in the announcements forum.

http://www.anc.ed.ac.uk/~dcs/progs/neuron/

Any suggestions or edits to the code would be welcome. The list of highligted words almost certainly isn't complete.

All the best,

David.
davidsterratt
Posts: 28
Joined: Tue Jan 17, 2006 11:36 am

Updated version of emacs hoc mode

Post by davidsterratt »

Following Raj's helpful suggestions, I've updated the emacs hoc mode.
Post Reply