Save the NEURON model and the geometry

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
mattions
Posts: 65
Joined: Tue Jul 15, 2008 11:21 am
Location: EMBL-EBI Cambridge UK

Save the NEURON model and the geometry

Post by mattions »

Is it possible to save the model, the geometry and the simulation results with NEURON and load them again?

Using the python interpreter, in a programmatic way (not from the GUI)
ted
Site Admin
Posts: 6388
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Save the NEURON model and the geometry

Post by ted »

mattions wrote:Is it possible to save the model, the geometry and the simulation results with NEURON and load them again?
This question is loaded with multifaceted ambiguity. Here is an attempt to provide some clear answers.

Restricting ourselves for the moment to program source code, "model" is often used to refer to all of the following:
1. code that specifies the biological properties (anatomical and biophysical properties) that are to be represented
2. code that specifies the user interface for specifying parameters and/or displaying results
3. code that specifies how simulation execution will proceed (fixed vs. variable time step, whether and how any parameter might change in the middle of a simulation, which if any results will be saved and at what intervals they will be sampled)
4. code that analyzes results after the completion of simulation execution

Programming for NEURON involves the use of procedural programming languages (hoc and/or python interpreter, NMODL for compiled mechanisms), or the use of GUI tools (which actually work by executing hoc statements), or some combination of the two.

Execution of model setup code creates data structures that represent the equations that NEURON's computational engine will solve in the course of a simulation. The hoc SaveState class has the method save() that allows you to capture the "states" of a model at a particular instant in time. These are the values of key variables, mostly voltage and other variables that are governed by differential equations. They can then be saved to, or read from files, and the restore() method can be used to reset the computational model to that same condition--with certain caveats (read about the SaveState class in the Programmer's Reference). However, if you exit NEURON, the equations and their states no longer exist--you must execute the source code again, before you can restore the states.

NEURON's GUI tools allow users to create model specifications, build user interfaces, and set up simulation control. Many of these tools contain enough information that they can be "saved" to a hoc file (called a "session" file). Then you can exit NEURON, and later when you want to restore the model specification, control code, user interface etc., just execute the session file.

Simulation results can be captured and saved by with the Vector class's record() method, then printed out to files.

If you want to do any of this from python, the surest way is to write python statements that execute the corresponding hoc code.
Post Reply