Suggestions for how to develop models

The basics of how to develop, test, and use models.

Suggestions for how to develop models

Postby ted » Thu Jul 05, 2007 9:18 pm

Suggestions for how to develop models

1. See https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=177

2. Work through the tutorials on the Documentation page.

3. Organize your modeling projects into directories. Things will be much easier if each
modeling project has its own directory. Put all the mod files you need in that directory,
and run mknrndll (nrnivmodl for UNIX/Linux users) to compile the mod files. Then make
a plain text file called init.hoc, which contains just this line
load_file("nrngui.hoc")
and put it in the same directory. Under MSWin, use the file browser (they call it
Windows Explorer to deliberately confuse people), double click on init.hoc, and
NEURON will start and automatically load your compiled mechanisms automatically
(UNIX/Linux users should just type
nrngui init.hoc
at the system prompt in an xterm).
After you have built your custom GUI (CellBuilder, RunControl, PointProcessManagers,
Graphs etc.), save them to a session file. Then edit init.hoc and change it to
load_file("nrngui.hoc")
load_file("mysesfile.ses") // or whatever you called the session file
The next time you double click on init.hoc (or type nrngui init.hoc), the mechanisms will
be loaded and your custom user interface and model will pop up.

4. As much as possible, use the GUI to specify model properties and
control simulations.

5. Whether using the GUI, writing hoc code, or combining the two, it is
best to start small and simple, and increase size and complexity
incrementally, with testing after every change.

6. Use the d_lambda rule (selectable from the Cell Builder at the click of
a button, but also usable from hoc--see the FAQ list) to specify spatial
discretization.

7. If it is ever necessary to write hoc code, structure your program as
follows:
Code: Select all
load_file("nrngui.hoc")
specify model topology (create sections, connect sections)
specify model geometry (stylized (L, diam) or pt3d method as appropriate)
specify instrumentation (IClamps, SEClamps, other Point Processes, graphs)
specify simulation flow control (RunControl panel is sufficient for most purposes)


8. Avoid load_proc()--it's very slow under MSWin, so unless you swear never
to use MSWin or exchange code with MSWin users, it's more bother than
it's worth.

9. Avoid writing your own "main computational loop" (i.e. a "for" or "while"
loop that calls fadvance() to march the simulation through time)--use the
standard run system's run() to launch simulations.

10. Use topology(), psection(), and especially the GUI's Model View tool to
discover what is actually in a model and verify a close match between
the model in the computer and the model in your mind. Especially if there
is a mismatch between what the model does and what you expected it to do.
ted
Site Admin
 
Posts: 1959
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Suggestions for how to develop models

Postby eschombu » Tue Nov 03, 2009 4:41 pm

9. Avoid writing your own "main computational loop" (i.e. a "for" or "while"
loop that calls fadvance() to march the simulation through time)--use the
standard run system's run() to launch simulations.


So then what method would you suggest for saving results? I currently use fadvance() to step through and save the data I need for later processing in vectors, lists, etc. I also don't save all the time steps in order to reduce my the number of post-simulation computations and output file size.
eschombu
 
Posts: 3
Joined: Tue May 26, 2009 11:15 am
Location: Caltech, Pasadena, CA

Re: Suggestions for how to develop models

Postby ted » Wed Nov 04, 2009 2:36 am

Use the Vector class's record() method, and defer writing data to file(s) until after the end of simulation execution. For documentation and examples, see the Programmer's Reference, and search the NEURON forum for "record" to find multiple posts that contain further discussion and more examples.
ted
Site Admin
 
Posts: 1959
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine


Return to Getting started

Who is online

Users browsing this forum: No registered users and 1 guest