Previous Next Table of Contents

24. GENESIS Command Reference

24.1 abort

Routine Name:   abort

Description:    Cleanly interrupts simulation in progress.

Usage:          abort

Example:        abort

Notes:          
See also: stop , step

24.2 abs

Routine Name:   abs

Description:    Returns absolute value of number.

Usage:          positive-number = abs any-number

                positive-number         returned as absolute value of
                                        any_number

                any-number              number (float or int) for which to
                                        compute absolute value

Example:        genesis >  echo { abs -22 }
                22

                genesis >  int x
                genesis >  float y
                genesis >  y = -33.333
                genesis >  echo { abs {y} }
                33.333000183
                genesis >  x = {abs {y}}
                genesis >  echo {x}
                33

Notes:          

24.3 acos

Routine Name:   acos

Description:    Returns angle (in radians) corresponding to given cosine.

Usage:          angle-in-radians = {acos cosine}

Example:        genesis >  echo { acos 1 }
                0

                genesis >  float degrees_per_radian = 360 / (2 * 3.1415926)
                genesis >  echo {{ acos 0.707} * degrees_per_radian}
                45.00865245

Notes:          
See also: cos

24.4 addaction

Routine Name:   addaction

Description:    Adds a named action to the action table used by element types.

Usage:          addaction name action_func
                addaction name id-number

Example:        addaction  NEWACTION  10
                addaction  K_squid_hh K_squid_hh_SET
                (see Scripts/tutorials/hhchan_K.g)

Notes:          Each object in a simulation is capable of performing one or
                more "actions".  An action can be described as an operation
                that an object performs on its data. Actions are defined
                within compiled functions which are attached to each object.
                (You can display a list of actions which an object can perform
                and the function(s) which perform using the showobject
                routine.)  For instance, objects of type compartment can
                perform the actions:

                RESTORE2  SAVE2  SET  CHECK  RESET  PROCESS  INIT  

                (The actions are actually performed by an underlying C
                function associated with the compartment element type.)

                You use the addaction routine to add the named action to the
                action table.  Actions are passed to the handler routines
                associated with each type of GENESIS object.  The handler is
                expected to perform the necessary actions when a given action
                type is passed to it by the simulator.

                For the most part this routine will only be used when adding
                new object types which require use of additional (non-default)
                actions already known to GENESIS.

                You use the addaction routine to define new actions to be used
                by elements.  There are a number of predefined actions 
                which are typically used by objects. PROCESS is one of them.
                New actions can be added in any object. Use the 'addaction'
                routine in the object definition script to inform the
                simulator of the new action. The case number assigned to new
                actions is relatively arbitrary as long as it does not
                conflict with the case numbers of other actions defined in the
                object.  (you should get a compiler error if there is a
                conflict). 

                When used as a GENESIS command, addaction is primarily used
                in the construction of extended objects.  It is also used as
                a library intialization command during the compilation of
                GENESIS libraries.
See also: object , Extended Objects, Defining New Objects and Commands ( NewObjects )

24.5 addalias

Routine Name:   addalias

Description:    Associates alternative name with existing GENESIS command.

Usage:          addalias alias-name command-name

Example:        addalias set setfield

Notes:          You may put a number of addalias statements in a file and
                use an include statement in the .simrc file to include the
                file when GENESIS is started.
See also: addescape

24.6 addclass

Command Name:   addclass

Description:    Adds a new class to list of currently recognized GENESIS
                element classes.

                Adds a new class tag to a given element.

Usage:          addclass [element] class-name

Example:        addclass /sine device

Notes:          The addclass routine adds a class tag to a given element
                identifying it as belonging to the given class.  Omitting
                the element defines a class name without assigning any
                element to the class.  (This is a deprecated usage which
                may not be supported in future releases).

                Objects can be grouped into named classes.  This
                grouping can be used to facilitate the specification of
                operations to be performed on functionally related
                elements.  See scheduling (e.g., the addtask
                routine, and Schedules) for an example of class use.

                Classes are simply used for grouping of related
                elements and do not alter the element functionality in
                any way.  Classes in GENESIS don't carry the full
                connotations of classes within a true object-oriented
                programming environment.  They are simply convenient
                ways of creating named groupings to which objects can be
                assigned.
See also: listclasses, deleteclass , showobject , Extended

24.7 addescape

Routine Name:   addescape

Description:    Adds an escape-key macro binding.

Usage:          addescape esc_sequence command-string [-execute] [-id string]

                esc_sequence            actual keystrokes (or representation)
                                        to associate with escape action

                command-string          string to insert in place when escape
                                        sequence is issued (should be in
                                        quotation marks if it contains blank
                                        spaces)

                -execute                flag to have command-string executed
                                        when escape sequence is called
                                        (this puts the field EXEC in the
                                        listescape table; if -exec is left
                                        out, default is REPLACE, i.e., insert
                                        command-string, unexecuted, in command
                                        line at point escape sequence is
                                        issued)

                -id string              label for this escape sequence, used
                                        typically to identify the escape
                                        sequence in user-understandable
                                        language

Example:        genesis >  addescape [15~ "/xproto" -id "F5"
                genesis >  le <F5>

                [line changes to:]

                genesis >  le /xproto
                /draw

                [associate command string 'echo "I am not a duck"' with key
                stroke sequence escape-a:]

                genesis >  addescape a "echo I am not a duck" -execute
                genesis >  <escape-a>
                I am not a duck

                [from escapelist.g file, included in startup:]

                addescape [A     <^P>                        -id "up arrow"
                addescape [B     <^N>                        -id "down arrow"
                addescape [C     <^F>                        -id "right arrow"
                addescape [D     <^H>                        -id "left arrow"
                addescape [1~    "execute movebol"   -exec   -id Find
                addescape [2~    <^I>                        -id "Insert Here"
                addescape [3~    <^D>                        -id Remove
                addescape [11~   stop                -exec   -id F1
                addescape [17~   "status -process"   -exec   -id F6
                addescape [18~   status              -exec   -id F7
                addescape [28~   "commands | more"   -exec   -id Help
                addescape [29~   step<CR>                    -id Do

Notes:          You use the addescape routine to create escape-key macros for
                commonly used command lines.  Here, the key is the key you
                will depress after the escape key, and command-string is the
                string which will be substituted into the SLI interpreter when
                the the escape sequence occurs.  (When the key is preceded by
                escape -- ctrl [ -- during keyboard input, the command-string
                is substituted.)

                A standard set of escape-key macros is specified during
                startup through the file escapelist.g.
See also: listescape

24.8 addfield

Routine Name:   addfield

Description:    Add an extended (user-defined) field to an element.

Usage:          addfield [element] field-name [-indirect element field]
                        [-description text]

                field-name      name of the new field to be added to element

                -indirect       make the field-name an alias for the a field
                                in another element

                -description    add a descriptive text string

Example:        addfield /cell/soma area -d "Area of the compartment"

Notes:          If you have a compartment, /soma, with a hh_channel
                /soma/hh_Na, then

                    addfield /soma Gk -indirect hh_Na Gk

                will add a field to /soma called Gk which is an alias for
                /soma/hh_na Gk.  Note that the path in the -indirect option
                is relative to the element to which you are adding the
                field.  The indirect element path can also be an absolute
                path.
See also: deletefield

24.9 addforwmsg

Routine Name:   addforwmsg

Description:    Forwards an incoming message to one element to another
                element.

Usage:          addforwmsg source-element message-number destination-element

                source-element  element from which the message will be
                                forwarded
        
                msg-number      number (index)  of message in message list
                                (messages are numbered from 0 up)

                destination-element
                                element to which the message will be forwarded

Notes:          The destination element must accept messages of the same
                name and with the same number of data slots as the message
                being forwarded.
See also: deleteforwmsg , showmsg , Extended

24.10 addmsg

Routine Name:   addmsg

Description:    Establishes message links between two elements.

Usage:          addmsg source-element dest-delement msg-type [msg-fields]

Example:        addmsg  /cell/dend /cell/soma      RAXIAL Ra previous_state
                addmsg  /cell/soma /cell/dend      AXIAL  previous_state
                addmsg  /cell/soma /graphs/Vmgraph PLOT   Vm *voltage *red

Notes:          addmsg sets up communication links to pass information
                between elements.  Messages flow along message links created
                by the addmsg routine each time a simulation timestep is
                executed.

                For example, an asymmetric compartment connected to another
                asymmetric compartment needs to send both its axial
                resistance, Ra, and its membrane potential at the previous
                simulation step to the second compartment.  In order to update
                its state, it needs to receive the second compartment's
                previous membrane potential.
See also: deletemsg , showmsg , getmsg , gen3dmsg, dd3dmsg

24.11 addmsgdef

Routine Name:   addmsgdef

Description:    Adds a new message type allowing messages of that type
                to be added to the element.

Usage:          addmsgdef element message-name [message-arguments...]
                 -type message-type

                element         element for which to add the message
                                definition
        
                message-name    name of the message (the convention is
                                to use all upper case)

                messages-arguments
                                zero or more names for the data slots
                                of the message

                -type           option to set the message type number
                                explicitly
                                
Notes:          It is normally unnecessary use the -type option as
                addmsgdef assigns an unused message type number
                automatically. -type should be necessary only for
                specifying active messages.
See also: deletemsgdef , showobject , Extended

24.12 addobject

Routine Name:   addobject

Description:    Adds a new object to GENESIS defined by the fields, message,
                actions and class tags of the given element.  The element
                is removed and used as a prototype for initial field values
                of new elements created from the new object.

Usage:          addobject object-name element -author author-info
                 -description descriptive-text ...

                object-name     the new name for the object

                element         element from which to create the new object
        
                -author         Information about the author of the object

                -description    A description of the object; multiple
                                arguments to -description may be given
                                resulting in multiple lines of descriptive
                                text

Notes:          The object name must not be the same as an existing
                object.  Currently, there is no corresponding
                deleteobject command.
See also: listobjects , showobject , Extended

24.13 argc

Routine Name:   argc

Description:    Returns argument count (number of arguments passed to a
                function).

Usage:          int-value = {argc}

Example:        if ({argc} > 3)
                        echo usage:  foo a b c
                        return
                end

Notes:          
See also: argv , arglist , getarg , printargs

24.14 arglist

Routine Name:   arglist

Description:    Converts list of items into an argument list.

Usage:          arglist string

Example:
                genesis >  str s ="a b c d"
                genesis >  echo { getarg {arglist {s}} -arg 3}
                c
Notes:
See also: argc , argv , getarg , printargs

24.15 argv

Routine Name:   argv

Description:    An array of strings containing the arguments passed to
                a function.

Usage:          argv position-number

Example:        

function echoargs
    int i
    echo "Number of arguments = "{argc}
    for(i=1;i<= {argc};i=i+1)
        echo {argv {i}}
    end
end

genesis > echoargs foo 5 1.23
Number of arguments = 3
foo
5
1.23

Notes:          As with C, indices of argv should start with 1.
See also: argc , arglist , getarg , printargs

24.16 asciidata

Routine Name:   asciidata

Description:  
    Converts a FMT1 formatted binary file (as produced by the
    disk_out object, for example) to ASCII.  Output is to stdout.

Usage: 
    asciidata file-name -time t -cell cell -gain g -old -xy -skip n -header
    One of options -cell, -time or -header must be given.

Example: (using the horiz_disk file from Scripts/orient_tut)

genesis > asciidata horiz_disk -header
FMT1
start time           = 0.000000e+00
time step            = 1.000000e-05
cellnum              = 25
data type            = 4
data size            = 4

genesis  > asciidata horiz_disk -cell 24 | more
-7.006086e-02
-7.012120e-02
.
.
-7.597300e-02
-7.596859e-02
//(provides Vm at each time step; adding -xy option gives t and Vm)

genesis > asciidata horiz_disk -time 1.e-4 -xy
0       -0.0706427
1       -0.0706427
2       -0.0706427
.
.
23      -0.0706427
24      -0.0706427
//(cell number and Vm for each of the 25 cells)

See also: disk_out

24.17 asin

Routine Name:   asin

Description:    Returns angle (in radians) corresponding to given sine.

Usage:          angle-in-radians = {asin sine}

Example:        genesis > echo {{ asin 0.5 }*(180/3.1415926)}
                30.00000135

Notes:          
See also: sin

24.18 atan

Routine Name:   atan

Description:    Returns angle (in radians) corresponding to given tangent.

Usage:          angle-in-radians = {atan tangent}

Example:        genesis >  echo { atan 0.876 }

Notes:          
See also: tan

24.19 call

Routine Name:   call

Description:    Allows an element to execute the function associated with the
                named action.

Usage:          call path action [args...] -parent -virtual

-parent         call the action on the element using the parent object
                of the current object context as the new object
                context

-virtual        call the action on the element using the element's
                object as the object context during the action.

Example:        call /form/graph RESET
                call /form/graph/plot ADDPTS {x} {y}

Notes:          The call routine allows the user to send an action to an
                element's handler routine (outside of the simulation cycle).

                An action executes in the context of a specific object which
                is either the element's object or some base object for the
                element.  The object context determines what fields,
                actions, messages and classes are known and accessibility of
                fields during execution of the action function.  Without any
                other options to call, the object context during the call is
                the element's object or the current object context if the
                element is already executing an action.  The -parent and
                -virtual options modify this.  These options are to be used
                when an action is called within the function definition of
                an action to be added with the addaction command.  They have
                no affect when used outside an action function.

See also:       addaction, Extended Objects (Extended.doc)

24.20 callfunc

Routine Name:   callfunc 

Description:    Allows you to call a function whose name is stored in a
                string variable.

Usage:          callfunc funcname ...

Example:        genesis  > str foo = "echo"
                genesis  > callfunc {foo} a b c
                a b c

Notes:          

See also:       

24.21 cd

Routine Name:   cd

Description:    Changes current working operating system directory.

Usage:          cd directory

Example:        genesis >  cd /usr/genesis/Scripts/neuron

Notes:          This is a GENESIS implementation of the operating system
                command cd, to assure that any change you make in the working
                directory is known to GENESIS.  (If you just issued a normal
                cd command directly, via "sh cd" for instance, the
                change in the current working directory would last only as
                long as the subshell created to enact the command, and future
                actions in GENESIS would not recognize a change.  The GENESIS
                implementation of cd fixes this.)
See also: sh

24.22 ce

Routine Name:   ce

Description:    Changes the current working element.

Usage:          ce element-path

                element-path    complete or relative pathname of element to
                                make current working element; can also be
                                operating-system style hierarchy
                                abbreviations, such as . (current),
                                .. (element above current)

Example:        ce /
                ce /proto
                ce output
                ce ..

                genesis >  create compartment foo
                genesis >  ce ^
                genesis >  pwe
                /foo
        
Notes:          All GENESIS elements exist in a hierarchy.  The root element
                lives at the top of the tree (designated by /) and child
                elements are created beneath the root.  You use the ce routine
                to move about the tree (much as you can use the "cd" command
                to move about the operating system file system).

                If the element-path specified in a ce call starts with a /
                then the path is assumed to be an absolute path from the root
                of the element hierarchy.  If the first character of the path
                specified is not a / then the path is assumed to be relative
                to the current working element.
See also: pwe , le , pushe , pope , stack

24.23 check

Routine Name:   check

Description:    Checks various aspects of simulation to catch specification
                errors.

Usage:          check

Example:        check

                genesis >  setfield /soma Rm -5000 Cm 0
                genesis >  check
                ** Error - Compartment : Invalid Rm. '/soma'
                ** Error - Compartment : Invalid Cm. '/soma'

Notes:          The check routine sends the CHECK action to the handlers for
                all enabled elements.  The CHECK action should verify the
                consistency and well being of the element and report any
                problems with it to the user.  (Each element which supports
                self-checking will be invoked with the CHECK action and report
                any problems.)

                In the example above, the CHECK action of the compartment
                checks to be sure that the Rm and Cm fields are set to
                positive values, and running a check prints an error message.
See also: addtask, setclock , enable, reset

24.24 chr

Routine Name:   chr

Description:    Returns ASCII character specified by number code.

Usage:          character = {chr ASCII-number}

Example:        genesis >  echo { chr 64 }
                @
                genesis > echo {chr 65}
                A
                genesis > echo {chr 97}
                a

Notes:          

24.25 clearerrors

Routine Name:   clearerrors

Description:    Resets error count to 0.

Usage:          clearerrors

Example:        clearerrors

Notes:          When the number of errors reaches its maximum value (default:
                10 syntax errors or 20 warnings) the current action is
                interrupted, the simulator goes back to the command line, and
                the errors are reset.  The clearerrors routine can be used to
                reset the error count before this occurs, allowing a
                simulation to continue running despite errors.
See also: maxerrors , maxwarnings

24.26 closefile

Routine Name:   closefile

Description:    Closes an ASCII file opened with the openfile routine.

Usage:          closefile filename

Example:        openfile myfile w
                writefile myfile 10 20 30
                closefile myfile

Notes:          When you open a file using openfile, you work on a copy of
                the file.  The closefile routine writes your changes back
                into the actual file and eliminates it from the list of open
                files.  (Closefile is automatically called for all opened
                files when you exit from GENESIS).
See also: openfile , listfiles , writefile

24.27 convert

Converting GENESIS 1.4 Scripts to GENESIS 2.0

What Does Convert Do?

GENESIS 2.0 includes a major revision of command format and command
option naming, script language syntax changes and changes in various
GENESIS features.  The convert program converts GENESIS 1.4 compatible
scripts to use GENESIS 2.0 syntax, commands and features.  Some
features have changed dramatically enough that an automatic conversion
to the new features is not feasible.  In these cases, convert generates
script code for compatibility libraries which support the GENESIS 1.4
features.

Some scripts can be converted and run successfully without any manual
changes to the converted scripts.  In most cases, however, some changes
to the converted scripts will be necessary.

The Conversion Process

Below is the process through which a GENESIS 1.4 script is converted
to run under GENESIS 2.0.

        1 - Use the convert program to convert scripts from 1.4 to
            2.0 syntax.

        2 - Fix any known problem areas (See, Convert Problem Areas).

        3 - Try the script out and fix any remaining problems.

Using the Convert Program

The easiest way to use convert is to create a new directory for the new
scripts, cd to the new directory and convert the files from the old
directory.  A simple shell procedure may be used to convert an entire
directory.  For example, if your 1.4 script files are in the directory
../oldscript, then the following shell commands will convert the entire
directory placing the converted scripts in the current working
directory:

  csh:
        foreach script (../oldscript/*.g)
            convert $script
        end

  sh:
        for script in (../oldscript/*.g)
            convert $script
        end

Global Script Variables

In order for convert to handle certain script expressions involving
global script variables, it must know what globals exist for a given
set of scripts.  (This is not a problem for a self contained script
where global variables are defined and used within the script.)
Often a single script file is devoted to defining and initializing
global variables and constants for a given set of scripts.

The -constants option of the convert program gives a list of script
files which define the global variables for the script set.  For
example, if the file constants.g contains global variable definitions
which are used througout a set of scripts in the ../oldscripts
directory then the following csh code would convert the scripts:

        foreach script (../oldscripts/*.g)
            convert $script -constants ../oldscripts/constants,g
        end

The -constants option will allow one or more scripts to be given.

Compatibility Libraries

Two areas of major change in GENESIS 2.0 are the Xodus GUI and support
for network modeling (e.g. GENESIS 1.4 connections).  Support for use
of these facilities in GENESIS 2.0 is provided by compatibility
libraries.

While the compatibility libraries allow faster conversion of GENESIS
1.4 scripts for use under GENESIS 2.0, these libraries will not be
aggresively supported and should be viewed as a transitional step in
converting scripts to GENESIS 2.0 facilities.  Those areas of your
scripts which use these libraries should eventually be recoded to use
the new GENESIS 2.0 features.  Assistance for recoding of these
features may be found in the new GENESIS 2.0 Reference Manual (not
available at this time).

The X1compat Library

Compatibility for GENESIS 1.4 features of Xodus is provided as a set of
scripts using GENESIS 2.0 extended objects to implement the old Xodus
objects and script functions to implement old Xodus commands.  To load
the X1compat library, include Scripts/X1compat in your SIMPATH and
include X1compat from your .simrc or your main simulation script.
Convert will not add an include statement for X1compat to your
scripts.

X1compat defines a set of old Xodus compatible objects which are named
using the prefix "x1" in place of the normal "x" prefix for Xodus
objects (e.g. xform becomes x1form, etc).  Convert will automatically
transform create statements from Xodus objects in 1.4 scripts to use
the X1compat objects.  Some support for field naming of old Xodus
objects is included in the new Xodus objects, which may allow direct
use of the new Xodus objects.  The -noX1compat convert option causes
convert not to perform the translation to X1compat objects.  This is
likely to be useful for only those scripts which use the basic Xodus
widgets (i.e. xform, xlabel, xbutton, xtoggle and xdialog).  Uses of
xdraw or xgraph are likely to require use of X1compat.

Convert and the X1compat library cannot address various issues of
layout of widgets on a form.  See, Convert Problem Areas, for more
information.

The Connection Compatibility Library

While GENESIS 1.4 connections are not a standard part of GENESIS 2.0, a
compatibility library may be compiled into GENESIS 2.0 which supports
the old connection feature.  (See, src/Makefile or Usermake for
instructions on including the library.) The library defines the
connection related objects (e.g. axon, synapses, etc) and the
connection related commands (e.g. region_connect, expweight,
radialdelay, etc) as well as connection specific commands which support
set/get/show of connections (e.g. setconn, getconn and showconn).
Access to connection fields is not supported by the GENESIS 2.0
setfield, getfield and showfield commands.

Convert will change connection related script statements as needed to
use the Connection Compatibility Library.  In particular, it will
convert uses of set, get and show on connections to use setconn, et
al.  In some cases, convert will be unable to convert these statements
(See, Convert Problem Areas).

Converting User Libraries

Objects and commands defined in user libraries (for the most part) will
not need to change to run under GENESIS 2.0.  To compile your libraries
and create a new GENESIS you will need to replace and update your
Usermake, Libmake(s), liblist and perhaps the library startup script.

Copy the Usermake and liblist files from the GENESIS 2.0 installation
directory to your local GENESIS directory renaming Usermake to
Makefile.  Add your user libraries to the Makefile and liblist files.

In each user library you must copy the Libmake from the GENESIS 2.0
installation directory into the library directory renaming it
Makefile.  Add your library specific information and files to the
Makefile.

The convert program cannot be used to convert startup scripts.  The
only changes you should need to make are to modify any GENESIS 1.4
script language features which change in 2.0 and to remove any
non-startup commands from the script.  (Startup commands are object,
addfunc, hashfunc, newclass and addaction.) Since a startup script is
usually straight line code and the typical commands in a 1.4 startup
script are the above named commands, there are normally no changes
required.  There are, however, some GENESIS 2.0 features you may want
to take advantage of in your startup scripts.  See the new GENESIS
Reference Manual section on library startup scripts for details.

Convert Problem Areas

There are a number of areas in which convert will be unable to
transform script statements or where the converted code will perform in
a less than optimal manner.  Each problem area described below must be
found and fixed manually.

Script Callbacks

Commands used as callbacks to script commands or functions are not
translated by convert.  As such, script callbacks like the following
would fail:

        create xbutton echoButton -script "echo -n this is a test"
        create xdialog vmDialog -script "set /mycompt Vm <v>"

The echoButton will result in a usage error when pressed and the
vmDialog will fail because the set command no longer exists.

Command Options in Script Variables

A command option which is passed to a command through a script variable
or as the result of a command or script function will not be
translated.  For example, if leoptions is a script string variable
holding the value "-R" (a recursive listing), then the following code
will not be converted:

        le {leoptions}

The code which sets leoptions must be found and changed.

Command Arguments That Look Like Options

All GENESIS 2.0 commands check for valid command options and complain
when an unkown option is given.  As a result, code like

        echo -notAnOption

will result in a usage error.  This will also be the case if a script
variable value looks like an option, e.g.

        str echoOption = "-notAnOption"
        echo {echoOption} // Usage error!

The usage statement can be avoided by placing whitespace before the
value, e.g.

        echo " -notAnOption"
        echo " "{echoOption}

Set/Get/Show Connections in Script Variables

Commands like

        set anElm:0 weight 10

will be correctly translated to use the setconn command.  However, code
like

        str connelm = "anElm:0"
        set {connelm} weight 10

will be translated to a setfield command.  Convert behaves similarly
with translating the get and show commands.

Script Variable/Command Name Conflicts

With all the command name changes in GENESIS 2.0, it is possible that a
script variable in a GENESIS 1.4 script may coinside with a new GENESIS
2.0 command name.  In this case, you may receive a syntax error or
unexpected result as the script variable will take precedence over the
command name.  This is may be particularly likely with the el command.

(The convert program may be updated at some future point to rename
 script variables which clash with GENESIS 2.0 command names.)

Setting Integration Methods

GENESIS 2.0 removes some of the previously existing integration methods
and renumbers some of the remaining methods.  Convert will handle the
renumbering as long as a number is given directly to the setmethod
command.  If this is not the case, convert will issue a warning and the
command will be left unaltered.  You must change the integration
numbering manually.  See setmethod.doc (or type "help setmethod" in
GENESIS) for the new numbering.

Sizing of Xodus Forms

XODUS 1 made use of an unsupported feature of MIT X11 which allowed
forms to automatically adjust their height to accomodate all the
widgets which they contain, even if the form was made too short.
Although this did not work under Openwindows, it allowed users of MIT
X11 to be somewhat sloppy in the sizing of forms when writing scripts.
This feature no longer exists in XODUS, so forms which are incorrectly
sized may not show all the widgets which they contain.  The most
convenient way to detemine the proper hgeom for the form is to properly
resize it with the mouse and then inspect the hgeom field for the value
to use in your script.

Apart from the preceeding issue, forms previously large enough to
encompass a given set of widgets may not be large enough under GENESIS
2.0, as the border widths of XODUS object have increased.

Positioning and Sizing of Widgets

Scripts which explicitly set the dimensions of a widget based on the
expected dimensional requirements of a 1.4 widget may cause text or
graphics within the widget to be clipped under 2.0.  This is due to the
additional requirements of the Motif style borders.

Likewise, widgets which are positioned using absolute coordinates on
the form based on expected default dimensions of other widgets on the
form may overlap other widgets on the form.

The only widget layouts used under GENESIS 1.4 which are likely to work
well under 2.0 are those using relative positioning.  Even if this is
the case, the form size may need to be changed (See Sizing of XODUS
Forms above).

24.28 copy

Routine Name:   copy

Description:    Copies an element (and its children, if any) from one portion
                of the element tree to another.

Usage:          copy src-element dest-element -repeat # -autoindex

                src-element     element to copy (if this element has
                                subelements, they too are copied)
                
                dst-element     location into which to copy src-element (if
                                dst-element already exists, src-element is
                                copied beneath it with original name; if
                                dst-element does not exist, copy of
                                src-element is given that name as new name)

                -repeat         is followed by an integer specifying how
                                many duplicates of src-element to make

                -autoindex      automatically assigns the first free element
                                index to the newly created element.

Example:        copy /cell1 /cell2

                // create 5 cells, cell[0-4]
                copy /library/protocell /cell[0] -repeat 5

Notes:          This routine copies an element and its children, without
                changing the original.

                Simulation messages and connections between elements within
                the copied subtree will be copied, but messages and
                connections to elements outside of the copied subtree will not
                be copied.

                After it has copied the object, the copy routine issues the
                COPY action for that element type, if any.
See also: create , createmap , move

24.29 cos

Routine Name:   cos

Description:    Returns cosine for given angle (specified in radians).

Usage:          cosine = {cos angle-in-radians}

Example:        float x
                x = {cos {3.14159/4}}

Notes:          
See also: acos

24.30 countchar

Routine Name:   countchar

Description:    Counts occurrences of specified character in string.

Usage:          number-of-occurrences = {countchar string char}

                number-of-occurrences   returned as integer indicating how
                                        many occurences of char were found
                                        in string

Example:        genesis >  echo {countchar "abcbdb" b}
                3

Notes:          

24.31 cpu

Routine Name:   cpu

Description:    Displays current cumulative cpu usage for user and system time.

Usage:          cpu

Example:        genesis >  cpu
                user time used          = 3 sec  510000 usec
                system time used        = 1 sec  180000 usec

Notes:          This routine calls the getrusage operating system command to
                display user/system usage statistics.

See also:       showstat

24.32 create

Routine Name:   create

Description:    Creates new element of specified element type.

Usage:          create element-type name -autoindex [object-specific-options]

                element-type    type of element; must be one of the valid
                                element types (objects) compiled into the
                                genesis executable, or an extended object
                                created with the GENESIS scripting language.

                name            element or path name where new element is to
                                be attached in the GENESIS element hierarchy;
                                if single name is given (i.e., no path
                                separators "/"), element is created on the
                                current working element [also can be indexed;
                                see below]

                -autoindex      automatically assigns the first free element
                                index to the newly created element.

                [options]       some elements can be created with additional
                                options which are specific to the object type
                                (see individual object documentation for
                                options)

Example:        create neutral /cell
                create compartment /cell/soma
                create xgraph voltage_plot

Notes:          The create routine is used to create new elements in the
                GENESIS element tree.  It generates an element of type
                "element-type" and places it in the element tree with the
                assigned name.

                The additional options which can be specified for the create
                routine depend on the element-type being created.  For
                example, elements which represent graphical widgets contain
                data fields for screen information such as the position and
                dimensions of the graphical object. This information may
                also be specified as an option in the creation of an element.

                    create compartment soma[0]
                    create compartment soma[1]
                    create compartment soma[10]
                    create compartment soma -autoindex

                In the example above, he name field of each element will be
                "soma" but the index fields will have values 0-2 and 10.
                The "-autoindex" option in the last statement creates the
                element with index 2.  Note that soma and soma[0] are
                equivalent i.e. the absence of an index implies an index of
                0 (the default).  Also note that the index is an arbitrary
                value and does not need to follow any order.
See also: listobjects , showobject , le

24.33 createmap

Routine Name:   createmap

Description:    Copies an element multiple times to form a two-dimensional
                array.

Usage:          createmap source dest Nx Ny -delta dx dy -origin x y -object

                source          path to the element that will be copied

                dest            pathname of the parent of the array of copies

                Nx,Ny           number of elements in the x and y dimensions
                                of resulting array

                dx,dy           distance between adjacent elements in the
                                array in x and y dimensions, in world or
                                actual coordinates (default: 1,1)

                x,y             position of first element of array (i.e.,
                                corner of array, in world coordinates
                                (default: 0,0)

                -object         indicates that the source is the name of
                                an object, rather than the path to an element

Example:        createmap /prototypes/cell /map 10 10
                createmap mycell  /network 3 5 -delta 0.1 0.2 -object

                [from /usr/genesis/Scripts/orient_tut/retina.g:]

                genesis > createmap /library/rec /retina/recplane \
                    {REC_NX}   {REC_NY} \
                    -delta  {REC_SEPX} {REC_SEPY}   \
                    -origin {-REC_NX * REC_SEPX / 2} {-REC_NY * REC_SEPY / 2}
                genesis > le /retina/recplane
                rec[0-99]/

Notes:          The createmap routine creates a two-dimensional array of the
                specified source element by making copies of the source
                element and assigning the copies x,y coordinates within the
                specified bounds.  The resulting array is placed under the
                specified destination path.  As with the copy command, the
                entire tree of child elements and messages is copied along
                with the source element.  When the "-object" option is
                used, the source is the name of a GENESIS object, instead of
                the path to an element tree.  This is most useful when a
                prototype cell is created as an extended object composed from
                a combination of basic objects with added fields and default
                values.

                The resulting array coordinates can be used by routines such
                as planarconnect, planarweight, and planardelay to assign
                connections, synaptic weights and propagation delays for
                simulation-oriented elements.  The coordinates can also be
                used to display the cells in a draw widget.
See also: copy , planarconnect , planarweight , planardelay , Extended

24.34 debug

Routine Name:   debug

Description:    Sets (or displays) the debug level used by some routines.

Usage:          debug [level]

                level           integer indicating debug level to use:
                                 0 = disable debug (nothing printed)
                                 1 = intermediate debug
                                 2 = intermediate debug
                                 3 = full Debug (print everything)

Example:        genesis >  debug
                debug level 0
                genesis >  debug 2
                debug level 2

Notes:          Sets the debug level used by some routines to report status
                information.  Increasing the level typically increases the
                amount of information produced. If no argument is given the
                current debug level is displayed.
See also: silent

24.35 delete

Routine Name:   delete

Description:    Deletes an element and all of its children.

Usage:          delete  element

Example:        delete /neuron

Notes:          The delete routine is used to delete elements from the GENESIS
                element hierarchy.  Deleting an element which has children
                attached to it will also delete all of the child elements.

                In the course of deleting the object, the delete routine also
                issues the DELETE action for the object before it is
                eliminated.
See also: create , reclaim

24.36 deleteaction

Routine Name:   deleteaction

Description:    Deletes an action from an element added by a previous
                addaction command

Usage:          deleteaction element action-name

                element         element to delete the action from
        
                action-name     name of the action to delete

Notes:          An object's built in actions are permanent and may
                not be deleted using deleteaction.
See also: addaction , listactions, Extended

24.37 deleteall

Routine Name:   deleteall

Description:    Deletes all existing elements.  [not recommended]

Usage:          deleteall -force

                -f              flag to force deletions

Example:        genesis > deleteall
                
                *** WARNING ***
                This function removes all elements from the simulation.
                If you really want to do this use 'deleteall -force'.

                usage: deleteall -force

                genesis > deleteall -f
                Simulator cleaned out.

Notes:          If no flags are specified, deleteall displays a warning
                message.

                The deleteall routine can be used to return the simulator to
                a startup state by deleting all existing elements, including
                elements which may be provided by default at startup.  If
                this is done, running the simulation scripts again could
                produce different results.

                If you really need to delete all the elements in your GENESIS
                session, you might as well quit exit from GENESIS completely
                and start again -- deleteall just deletes all the elements
                and might not reset other parameters to appropriate values.

                In general, you should not use the deleteall routine.
See also: delete

24.38 deleteclass

Routine Name:   deleteclass

Description:    Delete a class tag from an element which was previously
                added using addclass.

Usage:          deleteclass element class-name

                element         element from which to delete the class

                class-name      name of the class to delete
        
Notes:          Deleteclass will not delete classes defined for the
                built in objects.
See also: addclass , listclasses, Extended

24.39 deletefield

Routine Name:   deletefield

Description:    Deletes an extended field which has been added to an element.

Usage:          deletefield [element] field-name

Example:        genesis > addfield /soma area
                OK
                genesis > deletefield /soma area
                OK
                genesis > deletefield /soma inject
                deletefield: Cannot delete permanent field 'inject' on element '/soma'

Notes:          Only added extended field may be deleted with deletefield.
See also: addfield

24.40 deleteforwmsg

Routine Name:   deleteforwmsg

Description:    Deletes a forwarded message previously forwarded using
                addforwmsg.

Usage:          deleteforwmsg source-element message-number destination-element

                source-element  element from which the message was
                                forwarded
        
                msg-number      number (index)  of message in message list
                                (messages are numbered from 0 up)

                destination-element
                                element to which the message was forwarded

Notes:          The destination element must accept messages of the same
                name and with the same number of data slots as the message
                being forwarded.
See also: addforwmsg , showmsg , Extended

24.41 deletemsg

Routine Name:   deletemsg

Description:    Deletes a message link between two elements.

Usage:          deletemsg element msg-number -incoming -outgoing
                        -find srcelem type

                element         element receiving or sending the message

                msg-number      index of message in element message list
                                (index can be obtained with 'showmsg'
                                routine, or, in a script, with 'getmsg' used
                                with the -find option)

                srcelem         element sending the message

                type            message type (PLOT, AXIAL, VOLTAGE, etc.)

                -incoming       message to be deleted is incoming

                -outgoing       message to be deleted is outgoing

                -find           delete the first message (lowest index)
                                matching the srcelem and type

Example:        deletemsg /cell/soma 2 -incoming

                deletemsg /data/voltage -in 0 -find /cell/soma PLOT

Notes:          The deletemsg routine is used to remove messages added using
                the addmsg routine.  Deleting earlier messages will change
                the message numbers of the remaining messages.  If
                msg-number is not known for the desired message, it may be
                found by using getmsg with the -find option.

                When the -find option of deletemsg is used, the msg-number
                argument is required, but ignored, and the message must be
                an incoming one. (The -incoming and -outcoming options are
                ignored, if specified.)
See also: addmsg , showmsg , getmsg

24.42 deletemsgdef

Routine Name:   deletemsgdef

Description:    Deletes a message definition previously added to an element
                using addmsgdef.

Usage:          deletemsgdef element msg-name

                element         element from which to remove the message
                                definition
        
                msg-name        name of the message type to delete

Notes:          Deletemsgdef will not delete permanent message definitions
                defined by the built in objects.
See also: addmsgdef , showobject , Extended

24.43 echo

Routine Name:   echo

Description:    Prints out its arguments to the console.

Usage:          echo [arguments] [-nonewline] [-format format-string]

                arguments       strings, or expressions enclosed in braces

                -nonewline      do not include carriage return at end of line

                format-string   a string of the form "%[flag][width]s", where
                                "width" is the minimum number of characters
                                to be output.  If the output width is less
                                than this, it is padded with blanks.  "flag"
                                is as in C; "0" means pad with zeroes, "-"
                                means left justify.  (to construct mixed
                                formats, use multiple echo commands with
                                -nonewline to place them on a single line)

Example:        
                genesis >  int five = 5
                genesis >  echo five
                five
                genesis > echo { five }
                5

                genesis > echo "Give me" -n; echo space! -f %20s
                Give me              space!

Notes:          The echo routine is used to print output to the command
                interpreter window.  If echo is followed by a string (or a
                quoted string) that string will be printed.  If echo is
                followed by a string enclosed in curly brackets, then the
                value assigned the variable named by the string will be
                printed.

24.44 egg

Routine Name:   egg

Description:    Generates coordinates for points on the surface of an ovoid.

Usage:          egg  filename  x  y  z  d  -normal

                x, y, z         dimensions of the egg

                d               approximate distance between points

                -normal         "normal"; if selected, generates an additional
                                set of 3 coordinates is generated per line, to
                                define the normal to the surface

Example:        egg  eggfile  5  4  3  0.2

Notes:          Generates coordinates for points on the surface of an ovoid,
                and puts them into a file, with an option for generating the
                normals at each point.

                The output format (for normal too) is compatible with that
                read by the cellsheet routine.

                A routine for generating a set of points on an ellipsoid
                (egg).  It tries to get fairly even spacing.  This routine
                generates 3-d coordinates for the surface of an ovoid, i.e. an
                egg. The coordinates are dumped into the file specified by
                filename with one set of coordinates per line.

                This routine was developed for the olfactory bulb simulation,
                to generate cell layers along an ovoid.
See also: plane

24.45 el

Routine Name:   el

Description:    Returns list of elements matching wildcard specification.

Usage:          list-of-elements = el path [-listname listname]

                list-of-elements        returned as a text 

                path                    path specification, which may include
                                        wildcards such as [] or #  (note,
                                        however, that operating-system style
                                        use of * is not supported)

Example:        genesis >  echo {el /#}
                /proto /output  /net

                genesis >  echo {el /net/neuron[]}
                /net/neuron /net/neuron[1] /net/neuron[2] /net/neuron[3]
                
                genesis >  str name
                genesis >  foreach name ({el /# })
                ?  echo {name}
                ?  end
                /proto
                /output
                /net

Notes:          In GENESIS 1, this was EL or element_list.  getelementlist
                is an alias for el in GENESIS 2.

                The listname argument tells it to look for the field
                <listname> on the element in <path> and treat that
                as an element list.

24.46 enddump

Routine name:   enddump

Description:    Cleans up at the end of a dumpfile. Normally
                generated by default in a dumpfile. Doesn't do much of
                anything outside a dumpfile.

Usage:          enddump

Example:        Here is a little dumpfile using initdump that recreates a
                simple 2-compartment model, and ignores the orphan element
                /x/y/z.

                ============================================================
                //genesis

                initdump -version 3 -ignoreorphans 1
                simobjdump neutral
                simobjdump compartment activation Vm previous_state \
                        Im Em Rm Cm Ra inject dia len initVm
                simundump neutral /x/y/z 0
                simundump neutral /a 0
                simundump compartment /a/compt 0 0 0.6632976405 0.6632942696 \
                        -0.3333315551 0 1 1 1 1 0 0 0
                simundump neutral /b 0
                simundump compartment /b/compt 0 0 0.3299660931 0.3299627243 \
                        0.3333349228 0 1 1 1 0 0 0 0
                addmsg /b/compt /a/compt RAXIAL Ra Vm 
                addmsg /a/compt /b/compt AXIAL Vm 
                enddump
                // End of dump

                ============================================================
Notes:          
See also: initdump , simdump , simobjdump , simundump

24.47 exists

Routine Name:   exists

Description:    Tests for existence of specified element or field.

Usage:          exists-flag = {exists element [field]}

                exists-flag     returned as 1 if element (or element field)
                                exists; returned as 0 otherwise

                element         name or full pathname of element to test

                field           element field to test existence of
                                (does not check whether field is nonempty)

Example:        if ({exists /cell/dendrite})
                        delete /cell/dendrite
                end

                genesis > create compartment soma
                genesis > echo {exists soma}
                1
                genesis > echo {exists bogus}
                0
                genesis > echo {exists soma len}
                1
                genesis > echo {exists soma bogusfield}
                0

Notes:          

24.48 exit

Routine Name:   exit

Description:    Exits from GENESIS, terminating any simulation in progress.

Usage:          exit

Notes:          You can also use "quit", which is identical to "exit".

24.49 exp

Routine Name:   exp

Description:    Returns "e" raised to specified power.

Usage:          number = {exp power}

Example:        genesis >  echo { exp 1 }
                2.718281746

Notes:          
See also: log , pow

24.50 file2tab

Routine Name:   file2tab

Description:    Utility function for loading a file into an interpol struct
                of an element

Usage:          file2tab filename element table -table2 table -table3 table
                -xy xdivs -skiplines number -calc_mode mode -autofill table

Arguments:      filename: name of ascii file to load into table.  Entries
                          must be separated by spaces, tabs or line breaks.
                          Line breaks in input file are ignored. In other
                          words, any number of numeric entries per line are
                          allowed, and all are used.

                element:  path of element containing the table
                table:    name of interpol_struct within the element.

Options:        -table2 table
                This option allows one to specify an additional table to load 
                the file into. Entries are loaded alternately into the first
                table and table2. Note that table2 must be on the same
                element as table. If there are an odd number of entries in
                the file, the last one is not used.

                -table3 table
                This allows a third table. This option is similar to table2.

                -xy xdivs
                Uses xy mode for the table entries. Assumes that the points
                are stored in the file as x,y pairs. Uses the xdivs argument
                to set the table size, then figures out xmin, xmax
                and sets the table limits and dx accordingly. Uses dx 
                between all points and fills up table using linear
                interpolation if the x,y pairs in the file are not evenly
                spaced. Assumes x is monotonically increasing, behavior
                in other situations is undefined.

                -skiplines number
                Skips "number" lines at the start of the file. Useful
                for reading in 'xplot' files into a table, since these
                files usually have headers.

                -calc_mode mode
                'mode' is an integer representing one of the legal
                interpolation modes (0 = no interpolation, 1 = linear
                interpolation, 2 = fixed, see interpol doc).

                -autofill table
                table is the name of an interpol_struct in which we wish
                to place successive integers. Useful for displaying plots
                from a single series of numbers in a file:

                file2tab yvalue_file /form/graph/plot ypts -autofill xpts

                will load the numbers in yvalue_file into ypts, and put
                successive integers into xpts.

Example:        This simple example illustrates loading an xplot file into
                a table using different options to file2tab. In the first
                case we end up with the x and y values alternating. In
                the second case we end up with the y values only. In the 
                third case we use the xy mode to load the values into a linear
                table while preserving the x information.

                Datafile name is xplot.data:

                    /newplot
                    /plotname "testplot"
                    0 5
                    4 10
                    8 5
                    10 10

                script file:

                    //genesis

                    create table /tab1
                    file2tab xplot.data /tab1 table -skiplines 2
                    create table /tab2
                    file2tab xplot.data /tab2 table -table2 table -skiplines 2
                    create table /tab3
                    file2tab xplot.data /tab3 table -skiplines 2 -xy 50

                    showfield /tab1 *
                    showfield /tab2 *
                    showfield /tab3 *

-----------------------------------------------------------------------------

Notes:          The control fields of the interpol are set as follows:
                xdivs:  for 1 table:    (num_entries -1)
                        for 2 tables:   (int)(num_entries / 2 -1)
                        for 3 tables:   (int)(num_entries / 3 -1)
                xmin : 0
                xmax : 1
                calc_mode: defaults to 0 (lin-interp), but may be set on the
                        command line.
See also: tab2file, interpol_struct documentation ( Tables ), table

24.51 findchar

Routine Name:   findchar

Description:    Returns location of specified character in a given string.

Usage:          position = {findchar string char}

                position        returned as integer indicating position of
                                first occurrence of char in string (positions
                                start with 0); returns -1 if char not found in
                                string

                string          string to search

                char            single character to locate in string (any
                                extra characters in char are ignored)

Example:        genesis >  echo {findchar abcbx b}
                1
                genesis > echo {findchar "a bcbx" b}
                2
                genesis > echo {findchar abcbx bx}
                1
                genesis > echo {findchar abcbx q}
                -1

Notes:
See also: strcat , strcmp , strncmp , strlen , substring

24.52 findsolvefield

Routine Name:   findsolvefield

Description:    

Function which returns the array location of a particular variable in
the hines solver.  Used for input/output of values when the original element
has been taken over by the hines solver and its fields may not be updated.

Usage:          findsolvefield hsolve element field

                hsolve      name of the hsolve element
                element     name of an element which was taken over by hsolve
                field       the field of the element whiich is to be accessed

Example:        call /cell SETUP
                ...
                create disk_out /output
                addmsg /cell /output OUTPUT \
                    {findsolvefield /cell /cell/soma/Na_channel Gk}
                ...
                reset

Notes:

When using chanmodes 2 through 4 with the hines solver (hsolve), you can no
longer assume that all the fields of the elements which are taken over by
hsolve will be updated.  The findsolvefield function is used to access the
hsolve arrays directly to output field values instead of having to use the old
disabled elements.  The example above shows how to output the Gk field of
Na_channel from the hsolve element /cell.
See also: hsolve

24.53 floatformat

Routine Name:   floatformat

Description:    Sets format for display of variables of type float.

Usage:          floatformat format-string

                format-string   "%[flag][width].[precision][type]",
                                indicating format to use in displaying
                                float-type variables. (default: "%0.10g")
                                The flag, width, precsion and type are
                                defined as in C, but only f and g type
                                formats are allowed.

Example:
                genesis >  float x = 3.12345678
                genesis >  echo { x }
                3.12345678
                genesis >  floatformat %0.5g
                genesis >  echo { x }
                3.1235
                genesis >  floatformat %10.5g
                genesis >  echo { x }
                    3.1235
                genesis > floatformat %10.5f
                genesis > echo { x }
                   3.12346

                genesis > float y = 1e-5
                genesis > floatformat %0.10g
                genesis > echo {y}
                1e-05
                genesis > floatformat %0.10f
                genesis > echo {y}
                0.0000100000

                genesis > floatformat %+10.2f  // show sign
                genesis > echo {x}
                     +3.12

                genesis > float pi = 3.14159265
                genesis > floatformat %-10.2f //left justify with width 10
                genesis > echo {x} {pi}
                3.12       3.14

                genesis > floatformat %010.2f  // "0" flag pads with zeroes
                genesis > echo {x} {pi}
                0000003.12 0000003.14

Notes:          As in C, the width is the minimum number of characters to be
                output.  If the output width is less than this, it is padded
                with blanks, unless the "0" flag is used.  For type f, the
                precision is the number of digits after the decimal point;
                for type g, it is the maximum number of significant digits.

24.54 flushfile

Routine Name:   flushfile

Description:    The contents of a file opened with ``openfile <filename> w''
                and written with ``writefile <filename>'' are flushed from
                the buffer onto disk. The file remains open for further
                writefile operations.

Usage:          flushfile file-name

Example:

        genesis > openfile test w
        genesis > writefile test 1.0 2.0 3.0
        genesis > more test
        genesis >
        genesis > flushfile test
        genesis > more test
        1.0 2.0 3.0
        genesis > writefile test 4.0 5.0 6.0
        genesis > more test
        1.0 2.0 3.0
        genesis > closefile test
        genesis > more test
        1.0 2.0 3.0
        4.0 5.0 6.0

Notes:          This command is useful when the contents of a file need to
                be checked before a simulation has terminated. (Writefile
                alone does not flush the buffer, and file contents are only
                available after closefile has been issued).
See also: openfile , writefile , closefile

24.55 gaussian

Routine Name:   gaussian

Description:    Returns a random value from a Gaussian (Normal) distribution.

Usage:          value = {gaussian mean standard-deviation}

Example:        genesis  > echo {gaussian 0 1 }
                0.5069125295
                genesis > echo {gaussian 0 100 }
                -63.29789352

Notes:          
See also: randseed , rand

24.56 genesis

Routine Name:   genesis

Description:    Starts up the GENESIS program.  (operating system command)

Usage:          genesis [-usage][-nosimrc][-altsimrc filename][-notty][-nosig]
                        [-execdir dirname][-nice nice-level][-nox]
                        [-defaultcolor][-batch][-status][script arg1 ...]

                -usage          print the usage message, listing options.
                -nosimrc        ignore the .simrc file
                -altsimrc       use 'filename' instead of the .simrc file
                -notty          do not accept terminal input
                -execdir        change to 'dirname' after starting genesis
                -nice           give genesis 'nice-level' priority
                -nox            start GENESIS without initializing XODUS
                -defaultcolor   use the display's default colormap
                -batch          run genesis in the background
                -status         create a status line showing time, step, etc.
                script          name of a GENESIS script to run

Example:        %  genesis -altsimrc ~/.backup_simrc

        Starting Genesis
   ==========================================================================
                                  G E N E S I S
                                      Release Version: 2.0

             Copyright 1988 - 1995, California Institute of Technology

    Some components are copyright by the originating institution and are used
    with the permission of the authors.
   ==========================================================================

        Executable:         /usr/genesis/genesis

        ----------------------- Starting XODUS 2.0 -----------------------

        Startup script:     ~/.backup_simrc
        SIMPATH=. /usr/home/jouser/mystartup
        SIMNOTES=/usr/home/jouser/.notes
        GENESIS_HELP=/usr/genesis/Doc
                
        genesis #0 >

Notes:  When starting, GENESIS looks for an initialization file, .simrc,
        first in the current working directory, and then in your home
        directory.  After installing genesis, this file is created in the
        GENESIS installation directory.  After making any appropriate edits,
        you should copy it to your home directory and insure that the
        genesis executable is in your path.

        A new GENESIS command line option -defaultcolor will cause GENESIS
        to use the display's default colormap, even if the default visual is
        readonly.  The net result is that colorscale colors will be shared
        among multiple GENESIS processes, but GENESIS will fail to allocate
        a colorscale if the default colortable is full.  This option may be
        used to avoid X protocol errors on some SGI systems where the X11
        server defaults to a TrueColor (24 bit) visual.

See also: src/README

24.57 getarg

Routine Name:   getarg

Description:    Returns specified item from an argument list.

Usage:          getarg [arguments] -count -arg #
                One of -count or -arg must be given

Example:        genesis >  echo {getarg 11 22 33 44 55 -arg 3}
                33
                genesis >  echo {getarg 11 22 33 44 55 -count}
                5
Notes:
See also: argc , argv , arglist , printargs

24.58 getclock

Routine Name:   getclock

Description:    Returns value of specified simulation clock.

Usage:          clock-value = {getclock clock-number}

Example:        genesis >  echo { getclock 0 }
                0.001

Notes:          The getclock routine returns the current value of the
                specified simulation clock (as a floating point number).

See also: showclocks , useclock , setclock

24.59 getdate

Routine Name:   getdate

Description:    Returns operating system date-time.

Usage:          str-value = getdate

Example:        genesis >  echo { getdate }
                Thu Jun 22 22:11:13 1995

Notes:          This is a GENESIS implementation of the operating system
                date command, to have the value returned by the routine rather
                than displayed directly to the user.  This allows the current
                date to be used as a data value within GENESIS.
See also: sh

24.60 getdefault

Routine Name:   getdefault

Description:    Returns the default value of an object field.

Usage:          getdefault object-name field-name

Example:        genesis > echo {getdefault compartment Rm}
                1

Notes:
See also: setdefault

24.61 getelementlist

Routine Name:   getelementlist

Description:    Returns list of elements matching wildcard specification.

Usage:          getelementlist path -listname listname

Notes:          This is an alias for el.
See also: el

24.62 getenv

Routine Name:   getenv

Description:    Returns value of operating-system environmental variable.

Usage:          str-value = {getenv environment-variable}

Example:        genesis >  echo { getenv DISPLAY }
                babel.bbb.edu:0

Notes:          This is a GENESIS implementation of the operating system
                printenv command, to have the value returned by the routine
                rather than displayed directly to the user.  (GENESIS also
                includes a version of printenv to have the value displayed
                directly to the user.)  The getenv routine allows the value of
                the particular operating system environmental variables to be
                used as a data value within GENESIS.
See also: setenv , printenv

24.63 getfield

Routine Name:   getfield

Description:    Returns value of field in data structure of specified element.

Usage:          getfield [pathname] field

                field-value = {getfield pathname field}

                pathname        path specification (if wildcard specification,
                                current values of specified field for all
                                elements referred to are returned);
                                defaults to current working element

                field           name of field in element data structure
                
Example:        echo {getfield /cell/soma Vm}
                setfield /cell/soma Rm {getfield /form/Rm_dialog value}

Notes:          The getfield routine returns the value of fields in the
                specified path.
See also: setfield , showfield , getfieldnames

24.64 getfieldnames

Routine Name:   getfieldnames

Description:    Returns names of all existing fields in specified element.

Usage:          element-fields = {getfieldnames Element}

                element-fields          returned as a single line (i.e., a
                                        string without carriage returns)
                                        listing fields of specified element

Example:        echo { getfieldnames /output }

                str name
                foreach name ( {getfieldnames soma })
                echo {name}
                end

Notes:          
See also: getfield , showfield , setfield

24.65 getmsg

Routine Name:   getmsg

Description:    Returns information about a message into or out of element.

Usage:          getmsg element -incoming -outgoing -slot msg-number slot-number
                 -count -type msg-number -destination msg-number
                 -source msg-number -find srcelem type

                [One of -slot, -count, -type, -destination, -source or -find
                must be given]

                element         element for which to determine information
        
                msg-number      number (index)  of message in message list
                                (messages are numbered from 0 up)

                srcelem         element sending the message

                type            message type (PLOT, AXIAL, VOLTAGE, etc.)

                -incoming       look for an incoming message

                -outgoing       look for an outgoing message

                -slot           return the slot value for the given message
                                and slot numbers

                -count          return the number of messages in or out
                                of this element

                -type           return the message type for the message
                                having the index msg-number

                -destination    return the destination element for the
                                message having the index msg-number
                                
                -source         return the source element for the
                                message having the index msg-number

                -find           return the index (msg-number) of the first
                                message matching the srcelem and type

Example:        

        genesis > echo { getmsg /cell/dend1 -out -destination 0}
        /cell/soma
        
        genesis > echo { getmsg /cell/dend1 -out -source 0}
        /cell/dend1

        genesis > echo { getmsg /cell/dend1 -out -count }
        5

        genesis > echo { getmsg /cell/dend1  -in -destination 1 }
        /cell/dend1

        genesis > echo {getmsg /cell/soma -in -find /cell/dend1 RAXIAL}
        2

        genesis >  echo {getmsg /cell/soma  -in -type 2}
        RAXIAL

        genesis >  echo {getmsg /cell/soma  -in -slot 2 0}
        -0.07

Notes:          The -find option may only be used to find the index of
                an incoming message.  It returns -1 if there is no message
                from the specified source element and message type.

                The -count option may be useful if you want to loop over the
                index in order to find multiple messages which meet some
                specification.
See also: addmsg , deletemsg , showmsg

24.66 getpath

Routine Name:   getpath

Description:    Returns subpart of full element pathname.

Usage:          head-string = {getpath name -head}
                tail-string = {getpath name -tail}

                head-string     full path leading to element, without actual
                                element name

                tail-string     only actual element name, without full path

                name            an element pathname

Example:        genesis > echo {getpath /cell/soma/Na_channel -head}
                /cell/soma/
                genesis >  echo {getpath /cell/soma/Na_channel -tail}
                Na_channel

Notes:          You use getpath to extract the parent or head of a path.
See also: el , pwe , stack

24.67 getsyncount

Routine Name:   getsyncount

Description:    This function is used to count SPIKE messages coming from a
                particular presynaptic element and/or synapses on a
                particular postsynaptic element.  If both the presynaptic
                and postsynaptic elements are specified this function
                returns the number of connections between the two i.e. the
                number of SPIKE messages from the presynaptic element which
                are sent to the given postsynaptic element.  This function
                is often used inside a loop to set fields in synapses
                between specific elements to particular values.

Usage:          getsyncount [presynaptic-element] [postsynaptic-element]

                presynaptic-element  The element sending SPIKE messages to
                        postsynaptic targets.

                postsynaptic-element  The synchan or derived element which 
                        receives SPIKE messages.

Example:        // Set the weights of all synapses that receive SPIKE messages 
                // from a given source to 10.0

                int i
                str dest
                int nsyn = {getsyncount /input[0]/spike}
                for (i = 0; i = {nsyn}; i = i + 1)
                    dest  = {getsyndest /input[0]/spike {i}}
                    index = {getsyndest /input[0]/spike {i} -index}
                    setfield {dest} synapse[{index}].weight 10.0
                end

Notes:          Synchans have an "nsynapses" field which holds a count of the
                number of synapses on a given element; this can be used instead
                of getsyncount when getting synapse counts for postsynaptic 
                elements.  
See also: getsynindex , getsynsrc , getsyndest , BoG chapter 17

24.68 getsyndest

Routine Name:   getsyndest

Description:    Returns a string which is the path of the postsynaptic
                element which receives the nth SPIKE message sent by the
                given presynaptic element.  Can also return the index of
                the synapse on this element.

Usage:          getsyndest presynaptic-element spikemsg-number -index

                presynaptic-element  The element sending SPIKE messages to
                        postsynaptic targets.

                spikemsg-number The number of the SPIKE message whose
                        destination we want.  This can be obtained by getmsg
                        or showmsg.

                -index This option returns the index of the synapse which
                        receives the SPIKE message on the destination
                        element.

Example:        str dest  = {getsyndest input[0]/spike 0}
                int index = {getsyndest input[0]/spike 0 -index}
                setfield {dest} synapse[{index}].weight 10.0

Notes:          getsynindex can also be used to get the index of a synapse
                if you know the names of the pre- and postsynaptic elements.
See also: getsyncount , getsynindex , getsynsrc , BoG chapter 17

24.69 getsynindex

Routine Name:   getsynindex

Description:    getsynindex is used to find the index of synapses between
                particular presynaptic and postsynaptic elements.  

Usage:          getsynindex presynaptic-element postsynaptic-element
                        [-number n]

                presynaptic-element  The element sending SPIKE messages to
                        postsynaptic targets.

                postsynaptic-element The synchan or derived element
                       receiving the SPIKE message from the presynaptic
                       element.

                -number n  If there is more than one synapse between the
                           given pre- and postsynaptic elements, this option
                           will return the index of the nth such synapse.
                           This option will rarely be necessary, since
                           usually there is at most one synapse between a
                           given presynaptic and postsynaptic element.  

Example:        int index = {getsynindex /input[0]/spike /cell/soma/Ex_channel}
                if (index >= 0)
                    setfield /cell/soma/Ex_channel synapse[{index}].weight 10.0
                end

Notes:          If the desired synapse does not exist a value of -1 is
                returned.
See also: getsyncount , getsynsrc , getsyndest , BoG chapter 17

24.70 getsynsrc

Routine Name:   getsynsrc

Description:    Returns a string which is the path of the presynaptic
                element sending the SPIKE message to the synapse of the
                postsynaptic element with the given index.

Usage:          getsynsrc postsynaptic-element index

                postsynaptic-element The synchan or derived element
                       receiving the SPIKE message from the source element.

                index  The index of the synapse on a synchan or derived element
                       whose source you want.

Example:        str src = {getsynsrc /cell/soma/Ex_chan 0}
                if (src == "input[0]/spike")
                    setfield /cell/soma/Ex_chan synapse[0].weight 10.0
                else
                    setfield /cell/soma/Ex_chan synapse[0].weight 0.0
                end

Notes:          
See also: getsyncount , getsynindex , getsyndest , BoG chapter 17

24.71 h

Routine Name:   h

Description:    Displays the contents of the command-history buffer.

Usage:          h
                h [start [end] ]

                start           number of first command to list (default: 1)

                end             number of last command to list (default:
                                number of most recently issued command)

Example:        genesis > h 1 5
                     1    echo { x }
                     2    floatformat %0.5g
                     3    echo { x }
                     4    floatformat %2.5g
                     5    echo { x }

Notes:          Every command typed into the simulator at the keyboard is
                saved into a command buffer referred to as the 'history'.
                Commands saved in the history buffer can be re-executed using
                command recall mechanisms built into the script language.  The
                h routine displays the list of all commands in the range
                specified.  Typing h without any arguments will print the
                entire history buffer.  Typing h with a range will print all
                of the commands executed in the range specified.

                The following history recall functions are also built into the
                script language:

                Command   Example   Description
                --------------------------------------------------------------
                !!        !!        Re-execute last command.
                !n        !5        Re-execute the fifth command entered.
                !string   !echo     Re-execute the last command whose first
                                    chars match the string entered.
                ctrl-P    ctrl-P    Retrieve previous command in the history
                                    buffer. Repeat ctrl-P's to scan backwards
                                    through previous commands.
                ctrl-N    ctrl-N    Scan forward, after executing ctrl-P's,
                                    to echo next command.

24.72 help

Routine Name:   help

Description:    Displays help on GENESIS topics.

Usage:          help [ topic [help-directory-list] ]

                topic                   string (typically a routine name)

                help-directory          list of directories containing
                                        ascii help files

Example:        genesis >  help CONTENTS | more
                genesis >  help synchan  | more
                genesis >  help myroutine /myhelpdirectory /basichelp

Notes:          Help searches specified help directories for documentation on
                the given topic (typically a routine name).  If no directory
                is specified then the current default help directory (the last
                help directory referenced) will be used.  If no default help
                directory exists (e.g., when help is used for the first time),
                the value of the environment variable GENESIS_HELP is used as
                the help directory (cf. setenv, getenv); this variable is
                set to the genesis/Doc directory, using the full path
                given in the default .simrc file.

                As most of these files are longer than a single screen, it is
                best to pipe the output into "more".

                If no topic is given, the genesis/Doc/README file is printed
                to the screen.   This gives further information about the
                current version of the one-line help, the GENESIS Reference
                Manual, and the hypertext documentation.

                [for help writers:]

                The Help facility allows text to be included from other files
                (use ## as first characters on a line, followed by the local
                file name; you can omit the .doc suffix).  For instance, you
                might create the following file trig.doc:

                        TRIG Routines
                        ##cos
                        ##sin
                        ##tan

                When you type "help trig" to view this file, instead of seeing
                the text "##cos" etc., the contents of the file cos.doc would
                be read in and displayed at that point in the file.

24.73 initdump

Routine name:   initdump

Description:    Initializes the simulation dumping/undumping system.  Normally
                generated by default in a dumpfile, but it can be overridden
                from the script to set various flags.

Usage:          initdump -version # -ignoreorphans # -allowmsgdup

                -version #: The version number of the dumpfile. Allows it to
                read old dumpfiles. Each dumpfile keeps its version number in
                its header. This is relevant only for reading in dumpfiles, as
                simdump always dumps using the latest version.

                -ignoreorphans #: # can be 0 or 1. Orphans are elements
                without a parent. If ignoreorphans is 1, then simundump will
                simply skip over orphan elements. Otherwise it will complain.

                -allowmsgdup: When a dumped simulation is being loaded onto
                an existing one, then some messages are likely to be duplicated.
                Normally such duplicate messages are detected and are NOT
                created. This flag disables the mechanism that protects
                dumps from duplicating msgs when the elements specified in
                the dumps overlap.

Example:        Here is a little dumpfile using initdump that recreates a
                simple 2-compartment model, and ignores the orphan element
                /x/y/z.

                ============================================================
                //genesis

                initdump -version 3 -ignoreorphans 1
                simobjdump neutral
                simobjdump compartment activation Vm previous_state \
                        Im Em Rm Cm Ra inject dia len initVm
                simundump neutral /x/y/z 0
                simundump neutral /a 0
                simundump compartment /a/compt 0 0 0.6632976405 0.6632942696 \
                        -0.3333315551 0 1 1 1 1 0 0 0
                simundump neutral /b 0
                simundump compartment /b/compt 0 0 0.3299660931 0.3299627243 \
                        0.3333349228 0 1 1 1 0 0 0 0
                addmsg /b/compt /a/compt RAXIAL Ra Vm 
                addmsg /a/compt /b/compt AXIAL Vm 
                enddump
                // End of dump

                ============================================================
        
Notes:          
See also: enddump , simdump , simobjdump , simundump

24.74 input

Routine Name:   input

Description:    Obtains input from the user at the GENESIS prompt.

Usage:          value = input [ prompt-string [ default-value]  ]

                value           value entered by user

                prompt-string   string to use to prompt user for input
                                (default: "?"; to use a string that includes
                                spaces, include the string in quotation marks;
                                in any case, two blank spaces are always
                                automatically shown after the prompt string)

                default-value   value to use if user responds by just pressing
                                the RETURN key (to use a string that includes
                                spaces, include the string in quotation marks)

Example:        genesis >  int x = {input "Value for x:" 3}
                (def = 3) Value for x:  666
                genesis >  echo { x }
                666

Notes:          The input routine can be used to get input from the keyboard.
                If supplied, the default-value is displayed before the
                prompt-string, in the form:
                
                    (def = <default-value>) prompt-string

24.75 le

Routine Name:   le

Description:    Displays a list of elements in the element tree.

Usage:          le [path] -recursive -type

                path            pathname of element (default: current
                                element);  path cannot include wildcards

                -r              recursively display entire tree starting
                                at given element

                -t              display object type along with element name
                                (type will be included in curly braces just
                                after element name)

Example:        genesis > le / -t
                *proto {neutral}        output {neutral}   
                cell/ {neutral}         data/ {xform}   

                genesis > le / -r
                *proto          output   
                cell/           data/   

                /cell:
                soma                                    

                /data:
                voltage/        RESET   
                RUN             QUIT   

                /data/voltage:
                x_axis          y_axis   
                title           volts   
                current                                 

Notes:          Unlike the listings produced by the analogous operating-system
                command "ls", the listings produced by the le routine show
                elements not in alphabetical order, but in the order in which
                they were created.

                In the le listings, items preceded by an asterisk (e.g.,
                *proto) will not participate in simulations (see the enable
                and disable routines for control of this).

24.76 listcommands

Routine Name:   listcommands

Description:    Displays a list of routines currently recognized by GENESIS.

Usage:          listcommands

Example:        genesis > listcommands | more

                Available commands:
                [routines are listed, one screen at a time]

Notes:          

24.77 listescape

Routine Name:   listescape

Description:    Lists available escape-key/command-sequence bindings.

Usage:          listescape

Example:        genesis >  listescape
                AVAILABLE ESCAPE KEYS
                ---------------------
                [29~       Do              REPLACE   step<CR>
                [28~       Help            EXEC      commands | more
                [18~       F7              EXEC      status
                [17~       F6              EXEC      status -process
                [11~       F1              EXEC      stop
                [3~        Remove          REPLACE   <^D>
                [2~        Insert Here     REPLACE   <^I>
                [1~        Find            EXEC      execute movebol
                [D         left arrow      REPLACE   <^H>
                [C         right arrow     REPLACE   <^F>
                [B         down arrow      REPLACE   <^N>
                [A         up arrow        REPLACE   <^P>

Notes:          The listescape routine displays a list of the current escape
                key to string bindings which have been created using the
                addescape routine (in reverse order of creation).
See also: addescape

24.78 listfiles

Routine Name:   listfiles

Description:    Lists ASCII files currently opened by openfiles routine.

Usage:          listfiles

Example:        genesis > listfiles

                OPEN ASCII FILES
                -----------------

                genesis > openfile run.g r
                genesis > listfiles

                OPEN ASCII FILES
                -----------------
                run.g                r

Notes:          
See also: openfile

24.79 listglobals

Routine Name:   listglobals

Description:    Lists currently defined GENESIS global variables and their
                current values.

Usage:          listglobals [global-symbols] -functions -variables

                -variables      only show variables (types int, float, str)
                -functions      only show functions (type function)
                                
                (Uses last switch on line; if no switches, shows both
                functions and variables.  If the name is given, it shows
                only that global-symbol.)

Example:        genesis >  listglobals
                int             B_SPLINE_FILL = 0
                int             C_SPLINE_FILL = 1
                int             LINEAR_FILL = 2

Notes:          Four datatypes are recognized in listglobals:

                        int
                        float
                        str
                        function
See also: echo , Variables , Functions

24.80 listobjects

Routine Name:   listobjects

Description:    Lists available element types.

Usage:          genesis >  listobjects

Notes:          The listobjects routine displays a list of the element types
                currently defined within GENESIS.  GENESIS comes with an
                extensive set of element types already included.
See also: showobject

24.81 log

Routine Name:   log

Description:    Returns logarithm (base "e") of number.

Usage:          log-value = {log number}

Example:        genesis >  echo { log 1 }
                0
                genesis > echo {log {exp 1}}
                0.9999999404
                genesis > echo {log 0}
                -Infinity

Notes:          To get the base 10 log of x, use {log {x}}/{log 10}.
See also: exp

24.82 logfile

Routine Name:   logfile

Description:    Activates/deactivates logging of all commands issued in
                GENESIS session.

Usage:          logfile file-name
                logfile -off

                file-name       name for file in which to save record of
                                messages typed to or displayed at the GENESIS
                                shell -- if file already exists, information
                                will be appended; if file does not exist,
                                it will be created and information entered

                -off            flag to deactivate logging

Example:        genesis >  logfile mylog
                logging to 'mylog' at Sat Jun 24 18:44:59 1995
                ...
                genesis >  logfile -off
                logging done at Sat Jun 24 19:08:08 1995

Notes:          The logfile routine is used to activate command line logging.
                All commands typed from the keyboard as well as various error
                messages reported by the simulator will be saved in the
                specified logfile.
See also: notes

24.83 max

Routine Name:   max

Description:    Returns maximum value of two numbers.

Usage:          maximum-value = {max value1 value2}

Example:        genesis > echo {max {tan 0.1} 0.1}
                0.1003346741

Notes:                          
See also: min

24.84 maxerrors

Routine Name:   maxerrors

Description:    Sets (or displays) number of errors currently allowed before
                a simulation is automatically stopped.

Usage:          maxerrors [number-of-errors]

Example:        genesis >  maxerrors
                max errors = 10
                genesis >  maxerrors 30
                max errors = 30

Notes:          By default, the maximum number of errors allowed before the
                system stops a simulation is 10.
See also: maxwarnings , clearerrors

24.85 maxwarnings

Routine Name:   maxwarnings

Description:    Sets (or displays) number of warning messages currently
                allowed before a simulation is automatically stopped.

Usage:          maxwarnings [number-of-warnings]

Example:        genesis >  maxwarnings
                max warnings = 20
                genesis > maxwarnings 40
                max warnings = 40

Notes:          By default, the maximum number of warning messages allowed
                before the system stops a simulation is 20.
See also: maxerrors , clearerrors

24.86 min

Routine Name:   min

Description:    Returns minumum value of two numbers.

Usage:          minimum-value = min {value1 value2}

Example:        genesis > float x = 33.333
                genesis > int y = {x}
                genesis > echo {min {x} {y}}
                33

Notes:          
See also: max

24.87 move

Routine Name:   move

Description:    Moves an element and its children from one portion of the tree
                to another.

Usage:          move src_element dst_element

                src_element     element to move (if this element has
                                sub-elements, they too are moved)
                
                dst_element     location into which to move src_element (if
                                dst_element already exists, src_element is
                                moved beneath it with original name; if
                                dst_element does not exist, src_element is
                                given that name as new name)

Example:        move /cell1 /cell5

                create neutral /network
                move /cell[1] /network

Notes:          In the example above, if /cell5 does not exist, /cell1 will
                be renamed to /cell5.  The second example turns /cell[1]
                into /network/cell[1].
See also: copy

24.88 notes

Routine Name:   notes

Description:    Allows user to enter text notes into a file.

Usage:          notes [file]

                file            file into which to put notes (default:
                                most recent notes file used; if first time
                                in this GENESIS session, uses file specified
                                by operating system variable SIMNOTES) -- if
                                file already exists, notes will be appended;
                                if file does not exist, it will be created and
                                notes entered

Example:        genesis >  notes
                using notes file '/myhomedirectory/.notes'
                End with '.' alone on the last line
                ->  running the first tutorial script
                -> .
                genesis >  notes squid_notes
                using notes file 'squid_notes'
                End with '.' alone on the last line
                -> We may want to look at the tutorial for ideas
                -> about the implemention of voltage clamp
                -> circuitry.
                -> .
                genesis >  more squid_notes
                +------------------------------------------------------+
                Sat Jun 24 19:14:54 1995

                We may want to look at the tutorial for ideas
                about the implemention of voltage clamp
                circuitry.
                genesis >

Notes:          You end the note by including a period (.) on a line by itself.

                The note is entered into the notes file preceded by a dashed
                line and the date and time the entry was made.
See also: logfile

24.89 openfile

Routine Name:   openfile

Description:    Opens ASCII file for reading or writing.

Usage:          openfile filename mode

                filename        name of existing file to open for access from
                                other GENESIS file-manipulation routines

                mode            mode in which to open file:
                                r to open file for read-only access;
                                w to open file for write-only access (this
                                wipes out any content of the file; see Notes);
                                a to open file for appending to the file
                                (existing content is not erased, but
                                writefiles are allowed)

Example:        genesis >  openfile hello w
                genesis >  writefile hello 10 20
                genesis >  openfile oldfile r
                genesis >  echo { readfile oldfile }

Notes:          You can have up to 20 files opened simultaneously.

                You can read data from an opened file using the readfile
                routine, and write data to the file using the writefile
                routine (if the file was opened for writing).

                Beware: If you open a file for writing (mode w) that already
                has text in it, that text will be DELETED!
See also: closefile , listfiles , readfile , writefile ,

24.90 planarconnect

Routine Name:   planarconnect

Description:    Establishes synaptic connections between groups of elements
                based on the x-y positions of the elements.  This routine 
                sets up the connections by adding SPIKE messages between the 
                source and destination objects.

Usage:          planarconnect source_elements destination_elements \
                -relative \
                -sourcemask {box, ellipse} x1 y1 x2 y2 \
                -sourcehole {box, ellipse} x1 y1 x2 y2 \
                -destmask   {box, ellipse} x1 y1 x2 y2 \
                -desthole   {box, ellipse} x1 y1 x2 y2 \
                -probability p

                source_elements  A wildcarded list of elements which are the 
                        sources of the SPIKE messages.  These must be of
                        class "spiking" and are usually spikegen or 
                        randomspike objects.

                destination_elements  A wildcarded list of elements which are
                        the destinations of the SPIKE messages.  These must  
                        be synchans or objects derived from synchan.

                -relative This option means that connections will be set up
                        based on the locations of destination objects
                        relative to source objects.  If this option is not
                        selected, the absolute locations of source and
                        destination elements will be used to determine
                        whichconnections are to be set up.

                -sourcemask {box, ellipse} x1 y1 x2 y2  -- This specifies a
                        rectangular or elliptical region from which source
                        elements are to be taken.  If the "box" option is 
                        used, then x1 and y1 are the minimum x and y values
                        of the region while x2 and y2 are the maximum x and y
                        values of the region.  If the "ellipse" option is 
                        used, then the source region is an ellipse with x1
                        and y1 representing the center of the ellipse while
                        x2 and y2 represent the lengths of the principal axes
                        in the x and y directions respectively.  Note that
                        to choose a circular region x2 and y2 must be equal.
                        Note also that one or the other of {box, ellipse} 
                        MUST be chosen; leaving both of them out will generate 
                        an error.  Finally, one can choose multiple source 
                        regions by having multiple -sourcemask options.  
                        The same conventions are followed for the next three 
                        options.  

                -sourcehole {box, ellipse} x1 y1 x2 y2  -- This specifies a
                        rectangular or elliptical region NOT to include in
                        the source region(s).  You can exclude multiple 
                        regions by having multiple -sourcehole options.

                -destmask {box, ellipse} x1 y1 x2 y2  -- This specifies a 
                        rectangular or elliptical region to which SPIKE
                        messages will be sent.

                -desthole {box, ellipse} x1 y1 x2 y2  -- This specifies a
                        rectangular or elliptical region NOT to include in
                        the destination region(s). 

                -probability p  -- This option causes connections to be 
                        made with a probability p, which must be in the
                        range [0,1].  This allows probabilistically-connected
                        networks to be set up.

Example:        [From the "Orient_tut" simulation:]
                
                planarconnect /retina/recplane/rec[]/input     \
                              /V1/horiz/soma[]/exc_syn         \
                              -relative                        \
                              -sourcemask box -1 -1  1  1      \
                              -destmask   box {-V1_SEPX * 2.4} \
                                              {-V1_SEPY * 0.6} \
                                              { V1_SEPX * 2.4} \
                                              { V1_SEPY * 0.6}

Notes:          This routine calculates distance using only the x and y 
                coordinates of the element positions.  It is convenient for
                objects laid out in planar arrays but ignoring the z
                direction is somewhat unrealistic.  volumeconnect is almost 
                identical with planarconnect except that it uses the positions
                of elements in three dimensions to specify whether connections 
                are made or not.  

                The weights and delays of the connections set up by this   
                command are typically specified using the planarweight and 
                planardelay commands, although they can be set up by hand.
See also: volumeconnect , planarweight , planardelay ; Chapter 18 of the Book of GENESIS (2nd ed.) has a lengthy discussion on this and related commands.

24.91 planardelay

Routine Name:   planardelay

Description:    Sets the delay fields on groups of synapses between
                specified lists of elements.  Most often used to set
                delays on groups of synapses that have been set up
                by calling the "planarconnect" command.  This function
                can assign groups of synapses to a fixed delay, can
                assign delays in proportion to the distances between
                pre- and postsynaptic elements, and can add various
                types of randomness to delay values.

Usage:          planardelay sourcepath [destination_path]  \
                -fixed delay                               \
                -radial conduction_velocity                \
                -add                                       \
                -uniform scale                             \
                -gaussian stdev maxdev                     \
                -exponential mid max                       \
                -absoluterandom

                sourcepath  A wildcarded list of elements which are the 
                        sources of the SPIKE messages connecting the
                        pre- and postsynaptic elements (i.e. the presynaptic
                        elements).  These must be of class "spiking" and are 
                        usually spikegen or randomspike objects.

                destination_path  A wildcarded list of elements which must be
                        synchans or objects derived from synchan.  If this
                        (optional) argument is given, only the delays between 
                        the given set of pre- and postsynaptic elements will
                        be set by this command.  If this argument is not
                        given, then all the synapses receiving SPIKE messages
                        from the presynaptic elements will have their delays
                        set by this command.  NOTE: this optional argument is 
                        new and is not documented in the Book of GENESIS.

                -fixed delay  -- This option sets all the synaptic delays in
                        question to be equal to "delay".

                -radial conduction_velocity  -- This option sets the synaptic 
                        delays in question to be proportional to
                        the distance between the source and destination 
                        elements according to the equation:

                        delay = radial_distance / conduction_velocity

                        Where conduction_velocity is usually measured in
                        meters/sec (SI units).  "conduction_velocity"
                        represents the conduction velocity of the 
                        (hypothetical) axon that the spikes travel down.
                        For planardelay, the distance is measured as:

                        distance = 
                          sqrt((x_src - x_dest)^2 + (y_src - y_dest)^2)

                        where x_src is the x component of the source element,
                        x_dest is the x component of the destination element,
                        and so on.  Note that the z component is not taken
                        into account, which is unrealistic.  volumedelay
                        uses the z component as well.

                -add  This option causes the computed delays to be added to 
                        the preexisting delays in the synapses instead of
                        overwriting them.  This is useful when adding small 
                        synaptic delays, among other uses.  

                The next four options are used to add random components to the
                delays established using the -fixed or -decay options.  How
                these random components are added to the delays is explained
                below.

                -uniform scale  -- This option gives a random number taken 
                        from a uniform distribution in the range 
                        {-scale, scale}.

                -gaussian stdev maxdev  -- This option gives a random number
                        taken from a gaussian distribution centered on zero,
                        with a standard deviation equal to "stdev" and with
                        a maximum value of "maxdev".  The maximum value is
                        used to limit the random component to a given range.

                -exponential mid max  -- This option gives a random number
                        taken from an exponential distribution with a 
                        minimum value of zero, a 1/e point of "mid" and a 
                        maximum value of "max".  This is mainly for backwards
                        compatibility with genesis 1.4.

                -absoluterandom  This option alters the way the random number
                        is combined with the nominal delay to give the actual
                        delay, as described below.

                Once a random component has been created for a given delay, 
                it is used to set the delay as follows.  If the 
                -absoluterandom option has not been selected the delay is set 
                to be:

                final_delay = delay + (delay * random_number)

                Whereas if the -absoluterandom option has been selected then
                we have

                final_delay = delay + random_number

                Thus the default is to have the amount of randomness as a 
                constant proportion of the delay value.

Example:        [modified from the Orient_tut simulation:]

                planardelay /retina/recplane/rec[]/input \
                            -radial {CABLE_VEL}          \
                            -gaussian 0.1 0.3

                This command will set the size of the delays of synapses 
                that are receiving their inputs from 
                /retina/recplane/rec[]/input.  It gives delays equal to the
                radial distance between elements divided by the conduction
                velocity (CABLE_VEL).  It also specifies that gaussian noise 
                be added to the delays with a mean value of 0.1 (which 
                represents 10% of the original delay, since -absoluterandom 
                has not been selected) and a maximum value of 0.3 (which is 
                30% of the original delay value).

Notes:          The "destination_path" optional argument is new and is not
                documented in the Book of GENESIS.

                This routine calculates distance using only the x and y 
                coordinates of the element positions.  It is convenient for
                objects laid out in planar arrays but ignoring the z
                direction is somewhat unrealistic.  volumedelay is identical 
                to planardelay except that it uses the positions of elements 
                in three dimensions to calculate distances and is thus more 
                realistic.

                The delays are never allowed to go negative even if a large
                negative random component is added.  Negative delays are set
                to zero.

                If the -add option is chosen, the random component modifies 
                only the delay added and not the total delay.
See also: volumedelay , planarconnect , planarweight , syndelay ; Chapter 18 of the Book of GENESIS (2nd ed.) has a lengthy discussion on this and related commands.

24.92 planardelay2

Routine Name:   planardelay2

Description:    

Description:    A faster version of planardelay, which sets the delay fields
                on groups of synapses between specified lists of elements.
                Most often used to set delays on groups of synapses that have
                been set up by calling the "planarconnect" command.  This
                function can assign groups of synapses to a fixed delay, can
                assign delays in proportion to the distances between pre- and
                postsynaptic elements, and can add various types of randomness
                to delay values.

Usage:          planardelay sourcepath destination_path   \
                -fixed delay                              \
                -radial conduction_velocity                \
                -add                                       \
                -uniform scale                             \
                -gaussian stdev maxdev                     \
                -exponential mid max                       \
                -absoluterandom

Notes:          In contrast to planardelay, which can set the delays of all
                efferent synapses from the source map when no destination is
                given, planardelay2 only sets the delays of the synapses
                from the source map to a particular destination map.  By
                requiring the destination parameter, planardelay2 achieves
                faster setup times than planardelay.  For further details of
                usage and examples, see the documentation for planardelay.
See also: planardelay , planarconnect , planarweight , planarweight2

24.93 planarweight

Routine Name:   planarweight

Description:    Sets the weight fields on groups of synapses between
                specified lists of elements.  Most often used to set
                weights on groups of synapses that have been set up
                by calling the "planarconnect" command.  This function
                can assign groups of synapses to a fixed weight, can
                assign weights in proportion to the distances between
                pre- and postsynaptic elements, and can add various
                types of randomness to weight values.

Usage:          planarweight sourcepath [destination_path] \
                -fixed weight                              \
                -decay decay_rate max_weight min_weight    \
                -uniform scale                             \
                -gaussian stdev maxdev                     \
                -exponential mid max                       \
                -absoluterandom

                sourcepath  A wildcarded list of elements which are the 
                        sources of the SPIKE messages connecting the
                        pre- and postsynaptic elements (i.e. the presynaptic
                        elements).  These must be of class "spiking" and are 
                        usually spikegen or randomspike objects.

                destination_path  A wildcarded list of elements which must be
                        synchans or objects derived from synchan.  If this
                        (optional) argument is given, only the weights between 
                        the given set of pre- and postsynaptic elements will
                        be set by this command.  If this argument is not
                        given, then all the synapses receiving SPIKE messages
                        from the presynaptic elements will have their weights
                        set by this command.  NOTE: this optional argument is 
                        new and is not documented in the Book of GENESIS.

                -fixed weight  -- This option sets all the synaptic weights in
                        question to be equal to "weight".

                -decay decay_rate max_weight min_weight  -- This option sets
                        the synaptic weights in question to be proportional to
                        the distance between the source and destination 
                        elements according to the equation:

                        weight = (max_weight - min_weight) * 
                          exp(-decay_rate * distance) + min_weight

                        For planarweight, the distance is measured as:

                        distance = 
                          sqrt((x_src - x_dest)^2 + (y_src - y_dest)^2)

                        where x_src is the x component of the source element,
                        x_dest is the x component of the destination element,
                        and so on.  Note that the z component is not taken
                        into account, which is unrealistic.  volumedelay
                        uses the z component as well.

                The next four options are used to add random components to the
                weights established using the -fixed or -decay options.  How
                these random components are added to the weights is explained
                below.

                -uniform scale  -- This option gives a random number taken 
                        from a uniform distribution in the range 
                        {-scale, scale}.

                -gaussian stdev maxdev  -- This option gives a random number
                        taken from a gaussian distribution centered on zero,
                        with a standard deviation equal to "stdev" and with
                        a maximum value of "maxdev".  The maximum value is
                        used to limit the random component to a given range.

                -exponential mid max  -- This option gives a random number
                        taken from an exponential distribution with a 
                        minimum value of zero, a 1/e point of "mid" and a 
                        maximum value of "max".  This is mainly for backwards
                        compatibility with genesis 1.4.

                -absoluterandom  This option alters the way the random number
                        is combined with the nominal weight to give the actual
                        weight, as described below.

                Once a random component has been created for a given weight, 
                it is used to set the weight as follows.  If the 
                -absoluterandom option has not been selected the weight is set 
                to be:

                final_weight = weight + (weight * random_number)

                Whereas if the -absoluterandom option has been selected then
                we have

                final_weight = weight + random_number

                Thus the default is to have the amount of randomness as a 
                constant proportion of the weight value.

Example:        [modified from the Orient_tut simulation:]

                planarweight /retina/recplane/rec[]/input \
                             -decay 0.5 10.0 0.1          \
                             -gaussian 0.1 0.3

                This command will set the size of the weights of synapses 
                that are receiving their inputs from 
                /retina/recplane/rec[]/input.  It gives exponentially decaying
                weights with a maximum size of 10.0, a minimum size of 0.1,
                and a decay rate of 0.5.  It also specifies that gaussian
                noise be added to the weights with a mean value of 0.1 
                (which represents 10% of the original weight, since 
                -absoluterandom has not been selected) and a maximum value of
                0.3 (which is 30% of the original weight value).

Notes:          The "destination_path" optional argument is new and is not
                documented in the Book of Genesis.

                This routine calculates distance using only the x and y 
                coordinates of the element positions.  It is convenient for
                objects laid out in planar arrays but ignoring the z
                direction is somewhat unrealistic.  volumeweight is identical 
                to planarweight except that it uses the positions of elements 
                in three dimensions to calculate distances and is thus more 
                realistic.

                The weights are never allowed to go negative even if a large
                negative random component is added.  Negative weights are set
                to zero.

                The options -fixed and -decay are mutually exclusive.  The 
                different random options -uniform, -gaussian, and -exponential
                are also mutually exclusive.
See also: volumeweight , planarconnect , planardelay ; Chapter 18 of the Book of GENESIS (2nd ed.) has a lengthy discussion on this and related commands.

24.94 planarweight2

Routine Name:   planarweight2

Description:    

Description:    A faster version of planarweight, which sets the weight fields
                on groups of synapses between specified lists of elements.
                Most often used to set weights on groups of synapses that have
                been set up by calling the "planarconnect" command.  This
                function can assign groups of synapses to a fixed weight, can
                assign weights in proportion to the distances between pre- and
                postsynaptic elements, and can add various types of randomness
                to weight values.

Usage:          planarweight sourcepath destination_path   \
                -fixed weight                              \
                -decay decay_rate max_weight min_weight    \
                -uniform scale                             \
                -gaussian stdev maxdev                     \
                -exponential mid max                       \
                -absoluterandom

Notes:          In contrast to planarweight, which can set the weights of all
                efferent synapses from the source map when no destination is
                given, planarweight2 only sets the weights of the synapses
                from the source map to a particular destination map.  By
                requiring the destination parameter, planarweight2 achieves
                faster setup times than planarweight.  For further details of
                usage and examples, see the documentation for planarweight.
See also: planarweight , planarconnect , planardelay , planardelay2

24.95 plane

Routine Name:   plane

Description:    Generates 3-d coordinates for a plane with specified
                dimensions and characteristics.

Usage:          plane filename x y dx dy
                        [-center cx cy]
                        [-jitter jx jy]
                        [-normal]
                        [-ellipse]
                        [-hexagonal]

                filename        name for file into which to put generated
                                coordinates

                x               x dimension of rectangular area; if -e option
                                selected, x axis of ellipsoid area

                y               y dimension of rectangular area; if -e option
                                selected, y axis of ellipsoid area

                dx              spacing in x dimension between points

                dy              spacing in y dimension between points

                -center         flag specifying that center of plane should be
                                set at coordinates (cx,cy) (default: (0,0))

                cx              x coordinate of center of plane (default: 0)

                cy              y coordinate of center of plane (default: 0)

                -jitter         flag specifying that linearly random jitter
                                should be added to offset coordinates from a
                                perfect array (jitter in x dimension will vary
                                in range -jx*dx < jitter < jx*dx; jitter in y
                                dimension will vary in range
                                -jy*dy < jitter < jy*dy)

                jx              jitter in x dimension (as fraction of dx)
                                (default: 0)

                jy              jitter in y dimension (as fraction of dy)
                                (default: 0)

                -normal         flag specifying that an additional set of 3
                                coordinates is generated per line, to define
                                the normal to the surface (this format is
                                compatible with that read by the cell_sheet
                                routine)

                -ellipse        flag specifying that generated coordinates
                                should be restricted to lie in an ellipse with
                                major axes specified by x,y

                -hexagonal      (not yet implemented) flag specifying that
                                generated coordinates should lie in a
                                hexagonal (rather than rectangular) array

Example:        plane planefile 10 10 1 1
                plane planefile2 10 10 1 1 -c 20 20 -j 0.2 0.2 -n -e

Notes:          All of the cells in the plane have an initial z coordinate of
                0.0.  (See position for how to change this).
See also: cellsheet

24.96 pope

Routine Name:   pope

Description:    Restores previously stacked ("pushed") element as current
                working element.

Usage:          pope

Example:        genesis >  pwe
                /neuron
                genesis >  pushe /somewhereelse
                /somewhereelse
                genesis >  pwe
                /somewhereelse
                genesis >  pope
                /neuron
                genesis >  pwe
                /neuron

Notes:          This routine ("pop element") is analogous to the
                operating-system shell "popd" feature for directories.
See also: pushe , stack

24.97 position

Routine Name:   position

Description:    Sets xyz coordinates of an element and all of its children.

Usage:          position element x y z

                element         element whose coordinates to specify

                x, y, z         x, y, z coordinates to give element; to
                                specify absolute coordinates, use a number;
                                to specify coordinates relative to the current
                                position, use the form Rnumber; to ignore the
                                coordinate (leave it as it is), use I

Example:        position /neuron 10 20 4.6
                position /neuron I I R5.2
                position /neuron 1.5 R1.1 I
                position /V1/horiz 0 0 {-5 * V1_SEPZ}

Notes:          This routine affects the positions of the child elements as
                well as that of the parent.

24.98 pow

Routine Name:   pow

Description:    Returns a number raised to a specified power.

Usage:          raised-value = {pow number power)

Example:        genesis >  echo { pow 10 3 }
                1000

Notes:          
See also: exp

24.99 printargs

Routine Name:   printargs

Description:    Displays its arguments with argument numbers.

Usage:          printargs(argument)

Example:        genesis > printargs "a b c d"
                argc 1 : a,b,c,d
                genesis > printargs a b c d
                argc 1 : a
                argc 2 : b
                argc 3 : c
                argc 4 : d

Notes:
See also: argc , argv , arglist , getarg

24.100 printenv

Routine Name:   printenv

Description:    Displays value of operating-system environmental variable.

Usage:          printenv environment-variable

Example:        genesis >  printenv SIMPATH
                SIMPATH=. /usr/genesis/startup

Notes:          This is a GENESIS implementation of the operating system
                command printenv, which displays the value of a particular
                operating system environmental variable.  Unlike its
                operating-system counterpart, printenv from within GENESIS
                requires that you supply a variable name (outside of GENESIS,
                printenv with no arguments displays the list of all your
                environmental variables).

                Printenv sends its output directly to the screen.  If you need
                to capture the information that printenv displays in a GENESIS
                variable, use the getenv routine instead.
See also: getenv , setenv

24.101 pushe

Routine Name:   pushe

Description:    Saves current working element on stack (for later retrieval
                using pop), with option to go to new current working element.

Usage:          pushe [path]

                path            pathname of element to make new current
                                working element (default: leave pushed
                                element as current working element)

Example:        genesis >  ce /output
                genesis >  pushe /mitral
                /mitral
                genesis >  pwe
                /mitral
                genesis >  ce /
                genesis >  pope
                /output

Notes:          This routine ("push element") is analogous to the
                operating-system shell "pushd" feature for directories.

                pushe is used to change element to a new working element while
                saving the location of the current working element on a stack.
                The pope routine can then be used to return to the element path
                stored on the stack.
See also: pope , stack

24.102 putevent

Routine Name:   putevent

Description:    Used to place events into a buffer class element

Usage:          putevent buffer time amplitude [time amplitude]

Example:        

create playback /test
putevent /test 10 10.0 20 0.0 30 30.0 40 0.0 50 50.0 60 0.0
See also: playback

24.103 pwe

Routine Name:   pwe

Description:    Displays full pathname of current working element.

Usage:          pwe

Example:        genesis >  pwe
                /neuron/test
                genesis >  ce ..
                /neuron

Notes:          The pwe routine prints the path of the current working element
                in the GENESIS element hierarchy.  (This routine is analogous
                to the operating-system command "pwd", which prints the current
                working directory.)
See also: ce

24.104 quit

Routine Name:   quit

Description:    Exits from GENESIS, terminating any simulation in progress.

Usage:          quit

Notes:          Alias for exit routine.

24.105 rand

Routine Name:   rand

Description:    Returns a random number falling in a specified range.

Usage:          number = { rand lo hi}

Example:        genesis >  echo { rand 0 1 }
                0.2742720246
                genesis >  echo { rand 0 1 }
                0.5690608621
                genesis >  echo { rand 0 100 }
                32.53029251

Notes:          
See also: randseed

24.106 randseed

Routine Name:   randseed

Description:    Initializes random-number generator with new random seed.

Usage:          randseed  [seed]

Example:        genesis > echo {randseed}
                803971369
                genesis > randseed 54321

Notes:          Re-seeding the random-number generator insures that a
                simulation using commands or objects based on random numbers
                (e.g. rand or randomspike) produces different results each
                time that it is run.  If no argument is given, a seed is
                chosen using the system clock, otherwise the argument is
                used as the seed.
See also: rand

24.107 readcell

Routine Name:   readcell

Description:    Creates a model neuron from a description in a cell parameter
                file.

Usage:          readcell filename cellname -hsolve

                filename        name of the  cell descriptor file
                                (should end with extension .p)

                cellname        name of the neutral element to be at the
                                head of the tree of elements which comprise
                                the cell

                -hsolve         create cellname as an hsolve element

Example:        readcell cell.p /cell
                readcell cell.p /hcell -hsolve

        "cell.p" contains:

        *relative
        *cartesian
        *asymmetric

        *set_compt_param        RM      0.33333
        *set_compt_param        RA      0.3
        *set_compt_param        CM      0.01
        *set_compt_param     EREST_ACT  -0.07

        // For the soma, use the leakage potential (-0.07 + 0.0106) for Em
        *set_compt_param     ELEAK      -0.0594
        soma  none   30  0  0  30 Na_squid_hh 1200 K_squid_hh 360 spike 0.0

        // The dendrite has no H-H channels, so ELEAK = EREST_ACT
        *set_compt_param     ELEAK      -0.07
        dend  soma  100  0  0   2   Ex_channel 0.795775


Notes:

    The first example above will produce the element tree

        /cell/soma:
        Na_squid_hh K_squid_hh  spike

        /cell/dend:
        Ex_channel

    with the maxium channel conductances scaled by the area of the
    compartment.  Here, "/cell" will be a neutral element.  In the second
    example, "/hcell" will be an hsolve element.  This is the preferred way of
    creating a cell which is to be taken over by the Hines solver, as it
    automatically creates the hsolve element as the root of the element tree
    and sets the path for the elements to be solved.

    In cartesian coordinates, the format for each compartment parameter line
    in a cell parameter file is
    
        name parent x y z dia chan dens [chan dens] ...  

    For polar coordinates, it is

        name parent r theta phi dia chan dens [chan dens] ...

    Here, 'name' gives the name of the compartment, and 'parent' refers to
    the adjacent compartment to which it is connected.  'parent' may be
    replaced by '.' to refer to the compartment defined on the preceding
    line.  For asymmetric compartments, the connection to 'parent' is
    through the axial resistance (Ra) of 'name'.  The coordinates and
    diameter (x, y, z, dia) are in microns, all other units are SI (Meter,
    Kg, Second, Ampere).  In polar mode 'r' is in microns, theta and phi in
    degrees.  The compartment length, which is not stated explicitly, is
    calculated from the coodinates of the compartment and its parent.

    'chan' is the name of one of the channel prototypes under the neutral
    element '/library'.  The supported channel types are hh_channel,
    tabchannel, tab2Dchannel, tabcurrent, vdep_channel, synchan, hebbsynchan,
    ddsyn, receptor2, manuelconduct, and graded.  'chan' may also refer to the
    other neural element types:  spikegen, Ca_concen, difshell, difbuffer,
    concpool, and mmpump.  Presently, the obsolete channelA, channelB,
    channelC, channelC2, channelC3, and spike objects are also supported.

    For channels, 'dens' is the conductance density (Gbar or gmax per unit
    compartment area) in Siemens/m^2.  If a negative value is specified, the
    absolute value is taken, and it is interpreted as the maximum
    conductance in Siemens, without scaling by the compartment area.

    For spikegen elements, the 'dens' parameter is the 'thresh' field of
    the element.  For Ca_concen elements, it is the 'B' field, divided by
    the volume of the compartment.  However, if the 'thick' field of the
    Ca_concen element is non-zero, the volume is taken as area*thick,
    allowing B to be scaled as for a true shell.  A negative value of
    'dens' is used to indicate that it should be taken as an absolute
    value of B, without scaling.

    A maximum of 30 'chan dens' pairs are allowed in a compartment
    specification.  The '*compt' option described below provides a way to
    overcome this limitation.

    Several types of options may be specified in the cell parameter file.
    These options start with a '*', and affect all lines following them,
    until canceled by the opposite command.

    COMPARTMENT COORDINATES

    *relative           coordinates are relative to parent
    *absolute           coordinates are absolute (default)
    *polar              polar coordinates
    *cartesian          cartesian coordinates (default)

    *lambda_warn        will issue warning if the electrotonic length of the
                        compartment (in terms of the space constant, lambda)
                        is outside the range 0.01-0.20.
                                                    
    *lambda_unwarn      turns off lambda warning (default)

    COMPARTMENT SHAPE

    *spherical          make a spherical compartment
    *cylindrical        make a cylindrical compartment (default)
    *symmetric          make symmetric compartments
    *asymmetric         make asymmetric compartments (default)

    PARAMETER VALUES

    *set_compt_param variable value

        sets one of the following internal variables used by the cell
        reader to 'value'.  'value' may be a number, or the name of a
        globally defined script variable.

        RM            specific membrane resistance in ohm*m^2
        RA            specific axial resistance in ohm*m
        CM            specific membrane capacitance in farad/m^2
        EREST_ACT     resting potential in volts (initial Em and initVm)
        ELEAK         if specified, gives an alternate value for initial Em,
                      so that Vm will be initialized to initVm (EREST_ACT)
                      on reset, instead of Em.  Otherwise, ELEAK = EREST_ACT.

    *set_global variable value    

        similar to the above, but also sets the value of global script
        variables of the same name.  However, it does not support the ELEAK
        internal variable.  If the RM, CM, RA and EREST_ACT global variables
        have not been previously declared, readcell will create them.
        'variable' may also be the name of any other previously declared
        global script variable other than the internal variables listed
        above.  In this case '*set_global' may be used to set the values of
        these script variables.

    COMPARTMENT AND CELL PROTOTYPES

    *start_cell CELL_NAME     start new cell (in separate tree)

    *append_to_cell CELL_NAME append to existing cell

    *makeproto COMP_NAME      converts new cell to prototype configuration

    *compt COMP_NAME          all following compartments will be copies of
                              COMP_NAME, including its complete subtree,
                              with gmax/Gbar appropriately scaled (unless
                              'dens' is negative).

    These commands are illustrated in Scripts/int_methods/granule.p.

    Messages can be specified between elements in different compartment
    subtrees by creating and setting an extended field "addmsg#", where "#"
    is an integer.  This field will contain a string of the form "source
    destination message-name [values]", defining the message.

    SPINES and BRANCHES

    There are a variety of commands used for adding dendritic spines and
    branches to compartments.  These commands affect the passive structure
    of the neuron only.

    *memb_factor MEMB_FACTOR    scales all membrane surface by this factor

    *add_spines DENDR_DIAM SPINE_DENS SPINE_SUR   

        Adds membrane surface for collapsed spines to all compartments with
        dia <= DENDR_DIAM; units: um, 1/um, um^2.

    *rand_spines DENDR_DIAM SPINE_DENS SPINE_SURF AV_LENGTH SPINE_FREQ
        spine_proto

        Like above, but a random number of spines will be attached as copies
        of the compartment(s) spine_proto. The number of spines added
        depends on SPINE_FREQ and AV_LENGTH.  On the average a compartment
        with dia <= DENDR_DIAM and len = AV_LENGTH will receive n =
        SPINE_FREQ spines.  If SPINE_FREQ >= 1.0 then all compartments with
        dia <= DENDR_DIAM will receive at least one spine.  The dendritic
        surface area is still corrected for the 'missing' spines.
        
    *mrand_spines DENDR_MIN DENDR_DIAM SPINE_DENS SPINE_SURF AV_LENGTH
        SPINE_FREQ spine_proto

        Like above, but a random number of spines will be attached as copies
        of the compartment(s) spine_proto. Number of spines added depends on
        SPINE_FREQ and AV_LENGTH.  On the average a compartment with
        DENDR_MIN < dia <= DENDR_DIAM and len = AV_LENGTH will receive
        n=SPINE_FREQ spines.  If SPINE_FREQ >= 1.0 then all compartments
        with DENDR_MIN < dia <= DENDR_DIAM will receive at least one spine.
        The dendritic surface area is still corrected for the 'missing'
        spines on dendrites with dia <= DENDR_DIAM.

    *fixed_spines DENDR_DIAM SPINE_NUM SPINE_SURF SPINE_SKIP spine_proto

        Like above, but a fixed number of spines will be attached as copies
        of the compartment(s) spine_proto. Number of spines added is
        SPINE_NUM, from this command onward a spine will be added every
        SPINE_SKIP compartments (if dia <= DENDR_DIAM) The dendritic surface
        area is still corrected for the 'missing' spines.

    *mfixed_spines DENDR_MIN DENDR_DIAM SPINE_NUM SPINE_SURF SPINE_SKIP
        spine_proto

        Like above, but a fixed number of spines will be attached as copies
        of the compartment(s) spine_proto. Number of spines added is
        SPINE_NUM, from this command onward a spine will be added every
        SPINE_SKIP compartments (if DENDR_MIN < dia <= DENDR_DIAM).  The
        dendritic surface area is still corrected for the 'missing' spines.

    *rand_branches MAX_DIA RAND_FREQ NUM_ORDERS POSTFIX NUM_COMPS MIN_L
        MAX_L MIN_D MAX_D [NUM_COMPS MIN_L MAX_L MIN_D MAX_D] ...

        Adds more branches randomly at the end of dendrites.  The routine
        assumes that the .p file has a logical order, where each branch
        segment is defined in continuing lines and the first segment after a
        branchpoint is defined immediately after the segment before the
        branchpoint (if this is not the case the things might still work
        correctly by the MAX_DIA control).  The branching is binary (thus
        either 2 or 4 or 8 or ...  segments are added.  NUM_ORDERS (1-5)
        determines the number of branchpoints that are added.  For each
        branchpoint one gives the MIN_L and MAX_L (length) and MIN_D and
        MAX_D (diameter) and NUM_COMPS, the number of compartments per
        segment.  Adds smartly:  will skip thick segments if the existing
        dendritic tip is thin and will only add to 'tips' with a diameter <
        MAX_DIAM.  Frequency of addition of these branches is controlled by
        RAND_FREQ (0-1): if RAND_FREQ == 1 all tips smaller than MAX_DIAM
        will have branches appended.  The name will be the name of the
        parent + POSTFIX, indexed from 0 to 2^(NUM_ORDERS-1).  For a "full"
        addition (to a thick dendritic tip) the number of added compartments
        is 2*NUM_COMPS[1] + ... + 2*NUM_COMPS[NUM_ORDERS].
See also: writecell , compartment , Scripts/neurokit/README, Scripts/int_methods/granule.p

24.108 readfile

Routine Name:   readfile

Description:    Reads a line of data from an opened ASCII file.

Usage:          readfile filename -linemode

                -linemode       option indicating that entire line of file
                                should be returned as a single string, rather
                                than as a list of arguments (the latter is the
                                default)

                filename        name of ascii file (must be already opened
                                using r option of openfile routine)

Example:
        openfile test w
        writefile test 1.0 2.0 3.0
        writefile test 4.0 5.0 6.0
        writefile test 7.0 8.0 9.0
        closefile test
        openfile test r
        // 1st line as 3 args:
        echo {readfile test}
        // gives: 1.0 2.0 3.0
        // 2nd arg of 2nd line:
        echo {getarg {readfile test} -arg 2}
        // gives: 5.0
        // 3d line as one argument:
        echo {getarg {readfile test -l} -arg 1}
        // gives: 7.0 8.0 9.0

        // using the file Vm1 generated by the MultiCell demo
        function processline
           int step = {argv 1}
           float Vm = {argv 2}
           echo "Time step: "{step}
           echo "Membrane potential: "{Vm}
        end

        openfile Vm1 r
        processline {readfile Vm1}
        processline {readfile Vm1}
        .
        .
        closefile Vm1

Notes:          The readfile routine does not alter the file in any way.
See also: openfile , closefile , listfiles , readfile , getarg

24.109 reclaim

Routine Name:   reclaim

Description:    Reclaims memory from deleted elements

Usage:          reclaim

Notes:          Memory from deleted elements is usually freed when the
                simulator returns to the command prompt.  When running
                in batch mode in situations where many elements are being
                created and deleted, it may be necessary to use reclaim
                to free the memory from deleted elements.

                Care should be taken to ensure that deleted elements
                will not be actively executing after reclaim is
                called.  This should only be a potential problem within
                an extended object action function or a widget callback
                script.  Also, it should be noted that reclaim will
                recompute the simulation schedule which could be time
                consuming.
See also: delete

24.110 reset

Routine Name:   reset

Description:    Resets simulation to initial conditions.

Usage:          reset

Example:        genesis > reset
                time = 0.000000 ; step = 0

Notes:          The reset routine returns the simulation state to its initial
                conditions (e.g., the simulation time is set back to 0) and
                invokes each enabled element with the RESET action in order
                for them to place themselves back in the initial condition
                state.  You should reset the simulation whenever you are
                getting ready to start a new simulation run, or after you
                adding new elements to the simulation.

                If the initial state of one element depends on the initial
                state of another element, you may need to call the RESET
                action for specific elements in the proper order -- the reset
                routine gives no control over the order in which the elements
                are RESET, and the simulator does not check for such
                dependencies.

                For instance, the object which computes the Nernst equilibrium
                potential requires ionic concentrations. The initial potential
                therefore relies on the initial ionic concentrations. Thus the
                elements which compute the ionic concentrations must be reset
                before the elements which compute the concentration-dependent
                equilibrium potentials.

                It is up to you to determine whether reset order is
                important.  Also, you should make sure that any objects you
                create document the conditions under which these
                dependencies arise.

24.111 resetsynchanbuffers

Routine Name:   resetsynchanbuffers
 
Description:    resets the size of all synchan event buffers (and event 
                buffers of objects derived from synchan) to the default
                size (specified in the nodes_per_synapse field of the
                object).
 
Usage:          resetsynchanbuffers
 
Example:        genesis > resetsynchanbuffers
                genesis >

Notes:          This command also flushes all the pending events from the
                event buffers.  This command is never necessary unless
                you're running out of memory because there were too
                many spikes generated as inputs to synchan objects 
                This might happen, for instance, if you set up a
                simulation incorrectly so that huge numbers of spikes were
                generated by mistake.  For instance, if the abs_refract field 
                of a spikegen object is set to zero and the input to the
                spikegen crosses threshold then large numbers of spikes
                will be generated.
See also: synchan

24.112 restore

Routine Name:   restore

Description:    Restores element state stored in file with save routine.

Usage:          restore file-name

Example:        restore mycell.save

Notes:          After using the save command, restore may be used to restore
                save element field values from a file.  This allows you to
                resume a long simulation at the point where you left off.
                An element must be capable of performing the RESTORE2 action
                for its fields to be restored.
See also: save

24.113 rotcoord

Routine Name:   rotcoord

Description:    Rotates coordinates of elements in 3-d space.

Usage:                                   | -x            |
                                         | -y            |
                rotcoord element angle [ | [-z]          | ]
                                         | -a(xis) x y z |

                        [-c(enter) x y z]  [ | -t(ranslatekids) | ]
                                             | -f(ixkids)       |

                element         path of element to be rotated

                angle           angle (in degrees) for rotation

                -x              use x axis as axis relative to which to
                                rotate element

                -y              use y axis as axis relative to which to
                                rotate element

                -z              use z axis as axis relative to which to
                                rotate element (this is the default)

                -a(xis) x y z   use vector specified by x, y, z coordinates
                                as axis relative to which to rotate element

                -c(enter) x y z
                                offset center of rotation (default: 0,0,0)

                -t(ranslatekids)
                                have children of selected element translated
                                parallel to the parent rather than rotated
                                (default is to rotate)

                -f(ixkids)      prevent children of selected elements
                                from being moved

Example:        rotcoord /cell/primary_dendrite 30

Notes:          By default, all the children of the selected element are
                rotated as well.

24.114 round

Routine Name:   round

Description:    Rounds decimal number to nearest integer value.

Usage:          rounded-value = {round number}

                rounded-value           returned as integer

                number                  integer or floating-point number
                                        to round

Example:        genesis > echo { round 3.333 }
                3
                genesis > echo { round 3.666 }
                4

Notes:          This routine converts any number to an integer by rounding
                to the nearest whole number.
See also: trunc

24.115 save

Routine Name:   save

Description:    Saves current field values for specified element in a file. 

Usage:          save  path  file-name  -append

                path            pathname of element for which to save
                                field values in file

                file-name               name of file in which to store field values

                -append         flag specifying that field values should
                                be appended to file (if omitted, field
                                values overwrite any existing values in file)

Example:        save /cell/## mycell.save
                reset  // (Or quit and restart genesis)
                restore mycell.save

Notes:          The save and restore commands are useful when you need to
                resume a long simulation at the point where you left off.
                However, some of the older simulation objects do not have
                the required SAVE2 action which is invoked with save.  (The
                showobject command will list the actions performed by an
                object.)  When using hsolve elements in chanmode 2 or 3, one
                must also call HSAVE and HRESTORE for the hsolve element.
See also: restore , hsolve

24.116 scaletabchan

Routine Name:   scaletabchan

Description:    Performs scaling and offsets of the tabchannel A and B tables
                for a specified gate.

Usage:          scaletabchan channel-element gate mode sx sy ox oy -duplicate

                channel-element name of a the tabcahnnel
                gate            gate to be modified; one of: X, Y, or Z
                sx              x-axis (voltage) scale factor
                sy              y-axis scale factor
                ox              x-axis (voltage) offset
                oy              y-axis offset
                mode            one of: a[lpha] b[eta] t[au] m[inf]

Example:        // double (spread out) the voltage range for the Na
                // activation alpha rate constant.
                scale_tabchan Na X alpha 2.0 1.0 0.0 0.0

                // increase the K_dr activation time constant by 20%.
                scaletabchan K_dr X tau 1.0 1.2 0.0 0.0

                // shift the Na inactivation curve (Y gate) left by 5 mV.
                scale_tabchan Na Y minf 1.0 1.0 -0.005 0.0

                // increase the K_dr activation time constant by 0.1 sec.
                scaletabchan K_dr X tau 1.0 1.0 0.0 0.1

Notes:          The tabchannel internal tables for the specified gate are
                modified to provide scalings and/or offsets to the voltage
                dependent function specified by the mode.  Here, alpha and
                beta are the Hodgkin-Huxley rate constants, tau is the time
                constant for activation or inactivation, and minf is the
                steady state activation or inactivation.  The effect of
                applying these scalings and offsets may be viewed by using the
                edit_channel menu of Neurokit.

                Note that the scale and offset is always relative to the last
                operation, and not to the original values.  One can reverse
                changes in oy and sy because they just shift and scale the
                table values.  However, ox and sx perform offsets and scaling
                of the horizontal axes by moving data in the tables.  This can
                cause data to spill out of the ends of the tables and be lost.
                Thus, large changes in the x-axis should be avoided, if you
                plan to reverse your changes.

                In a large compartmental model or large network, one may have
                many copies of a particular prototype channel.  Usually, one
                wants these to behave identically.  It is also desirable to
                minimize the amount of storage space used by the internal
                tables.  For these reasons, copies of the channel which are
                created by the copy command or by readcell use the same tables
                as the original prototype, rather than creating new copies of
                the tables.  This is true of all objects which contain tabular
                fields.  Sometimes you may want to change just the one copy of
                the channel.  In this case, use the "-duplicate" option with
                scaletabchan.
See also: tabchannel , Tables .

24.117 setclock

Routine Name:   setclock

Description:    Sets time interval (step size) associated with specified clock.

Usage:          setclock clock-number value

Example:        setclock 0 0.01     // simulation time step in msec
                setclock 1 0.05     // plotting interval can be larger

                genesis >  setclock 0 5.5
                changing clock [0] from 1 to 5.5

Notes:          The setclock routine is used to set the current value
                assigned to the time increment for one of the GENESIS
                simulator clocks.  These clocks are updated each time a step
                is performed.

                Clock number 0 is the default clock used by each element to
                determine how often it should perform a simulation step.  When
                components of a simulation run at significantly different time
                scales, it may be useful to use other clocks (specified with
                useclock) having different time intervals.
See also: showclocks , useclock , getclock

24.118 setdefault

Routine Name:   setdefault

Description:    Sets the default value of an object field.

Usage:          setdefault object-name field-name value ...

Example:        genesis > setdefault compartment Em -0.07
                genesis > create compartment /soma
                OK
                genesis > showfield /soma Em

                [ /soma ]
                Em                   = -0.0700000003
                genesis > echo {getdefault compartment Em}
                -0.0700000003

Notes:          Once you have changed the default value of an object
                field, all elements created from that object will
                have that field initialized to the new value.
See also: getdefault

24.119 setenv

Routine Name:   setenv

Description:    Set value of operating system environmental variable.

Usage:          setenv environment-variable [new-value...]

Example:        genesis > setenv SIMPATH . ~/genesis/Scripts/neurokit
                SIMPATH=. ~/genesis/Scripts/neurokit

                [also see the GENESIS default .simrc file]

Notes:          This is a GENESIS implementation of the operating system
                command setenv, which lets you set the value of a particular
                operating system environmental variable.  Unlike its
                operating-system counterpart, setenv from within GENESIS
                requires that you supply a variable name (outside of GENESIS,
                setenv with no arguments displays the list of all your
                environmental variables).

                Unlike its operating system counterpart, setenv from within
                GENESIS displays the change that you make (outside of GENESIS,
                setenv just returns you to the prompt with no acknowledgement).

                The setenv routine is used most commonly from within GENESIS
                to define the DISPLAY and SIMPATH environment variables.
                DISPLAY determines the X11 host on which the display is made
                and SIMPATH lists the path which the simulator will search
                through for script files (cf. where).
See also: printenv , getenv

24.120 setfield

Routine Name:   setfield

Description:    Sets value of field in data structure of specified element.

Usage:          setfield  [pathname] field value [field value ... ...]

                pathname        name of element; if wildcard path
                                specification, all elements referred to will
                                have their fields set to specified values
                                (default: current working element)

                field           field in element data structure to which to
                                assign new value

                value           value to assign specified field

Example:        setfield /soma initVm -70.0
                setfield /test[] x 10 y 20 // for all indexed elements test[i]
                setfield x 10           // set value for current element

                genesis >  setfield /neutral_test x 100 y 50
                genesis >  showfield /neutral_test x y 
                
                [ /neural_test ]
                x           = 100
                y           = 50

Notes:          You can define and add additional fields with the addfield
                command.  These may then be set with the setfield command
                just like the predefined fields.
See also: getfield , getfieldnames , showfield

24.121 setfieldprot

Routine Name:   setfieldprot

Description:    Set the accessibility level element fields.

Usage:          setfieldprot element -readwrite fields ... -readonly fields ...
                    -hidden fields ...

                element         element for which to change field protections
        
                -readwrite      make the following fields readwrite

                -readonly       make the following fields readonly

                -hidden         make the following fields hidden

                -debug          turn on debugging mode; all hidden fields
                                are treated as if they were readonly and
                                any field may be made readwrite

                -nodebug        turn off debugging mode

Notes:          Hidden fields are not presented by showfield and are
                not readable in any way.  The presence of hidden fields
                may be determined using the showobject command.

                NOTE: The -debug option is intended to be used when
                debugging new objects.  Hidden and readonly fields
                should not usually be changed to readwrite as these
                fields are either private fields or computed by the
                object.  Setfieldprot will give a warning if a built in
                field is being made more accessible than the protection
                defined by the built in object.  If it is necessary to
                use debug mode to run a simulation please email the
                GENESIS development group and report the problem.
See also: addfield , showobject , Extended

24.122 setmethod

Routine Name:   setmethod

Description:    Sets integration method for elements to use in simulation.

Usage:          setmethod [path] method

                path            path of element for which to set integration
                                method (if omitted, specified method is
                                applied to all elements in the simulation)

                method          integer identifying integration method to use:
                                 -1  Forward Euler
                                  0  Exponential Euler (default)
                                  2  2nd order Adams-Bashforth predictor
                                  3  3rd order Adams-Bashforth predictor
                                  4  4th Adams-Bashforth predictor
                                  5  5th order Adams-Bashforth predictor
                                 10  Backward Euler
                                 11  Crank-Nicholson

Example:        setmethod /cell/##[OBJECT=compartment] 2

Notes:          The method used is stored within the "object" data structure
                of the element.  For example:

                genesis > showfield /cell/soma object->method
                [ /cell/soma ]
                object->method       = 2

                The default Exponential Euler method is a good compromise
                between speed, accuracy and ease of use for network models
                and single cell models involving a few compartments.
                Multi-compartmental models result in numerically "stiff"
                equations which are best solved with one of the implicit
                (Backward Euler or Crank-Nicholson) methods.  The implicit
                methods must used in conjunction with the hsolve object,
                which takes over the computations of compartments,
                tabchannels and other selected element types.
See also: hsolve

24.123 setprompt

Routine Name:   setprompt

Description:    Sets string to use as prompt for GENESIS shell.

Usage:          setprompt prompt-string

                prompt-string   string to use as shell prompt (default:
                                "genesis #!", where "!" is replaced by
                                command number); if you want to use a string
                                that includes blank spaces, you must include
                                the prompt in quotation marks to make the
                                string a single argument (additional
                                arguments are ignored)

Example:        genesis #13 >  setprompt tutorial
                tutorial >  setprompt "tutorial !"
                tutorial 15 >

Notes:          When starting up GENESIS the command line will appear as a
                prompt waiting for user input.

                genesis #0 > 

                The number contained in the prompt refers to the index of the
                command which is incremented for each line entered from the
                keyboard. This number can be used in conjunction with the
                'history' recall mechanism to re-execute commands based on
                their index.  [Note that GENESIS starts with 0 rather than 1.]

                The prompt string displayed in the command interpreter window
                can be set using the setprompt routine.  Specific simulations
                often wish to change the prompt to reflect the nature of the
                simulation.  
See also: h

24.124 setupalpha

Routine Name:   setupalpha

Description:    Sets up A and B tables of voltage-dependent gates based on
                generic equations describing the form of the alpha and beta
                rate functions.

Usage:          setupalpha channel-element gate AA AB AC AD AF BA BB BC BD BF \
                   -size n -range min max

                channel-element   This must be a tabgate or a tabchannel i.e.
                                  a voltage-dependent gate or channel with
                                  tabulated activation functions.

                gate              The name of the gate (must be X, Y, or Z).

                AA-AF             Coefficients A to F of the alpha table 
                                  (see below).

                BA-BF             Coefficients A to F of the beta table 
                                  (see below).

                -size n           Number of divisions in the table 
                                  (default = 3000).

                -range min max    Range of the table (default: min = -0.100; 
                                  max = 0.050).

                This routine makes it easy to set up the A and B tables of 
                tabulated channels or gates (tabchannel or tabgate objects) 
                when the equations describing the rate constants alpha and 
                beta are of the form:

                y(x) = (A + B * x) / (C + exp((x + D) / F))

                Many standard channels have alpha and beta parameters that can
                be cast into this form.  In these cases to set up the tables
                we can simply call setupalpha with the parameter values as
                arguments to the function.  Since there are both alpha and
                beta variables, we use the coefficients AA-AF to refer to the
                alpha variable and BA-BF to refer to the beta variable.

                setupalpha calls the TABCREATE action of the tabchannel or
                tabgate to allocate tables with n divisions (n + 1 entries)
                representing x values from min to max.  It then evalutes the
                functions at these points to fill the tables.

                The tables are by default set up in "no interpolation" mode, 
                which means that the process of finding the correct table
                value is simply a lookup operation.  With 3000 divisions in 
                the table (i.e. the table size is 3001) the lookup usually
                provides sufficient accuracy.  If not, you can override this 
                behavior; see the tabchannel documentation.  The range of the
                activation variable is between -0.100 and 0.050 by default.
                This is adequate for most voltage-dependent channels, but 
                can be overridden using the -range option.

Example:        from Scripts/neurokit/prototypes/traub91chan.g:

                create  tabchannel      Kdr_hip_traub91
                        setfield        ^       \
                        Ek              {EK}    \                  //      V
                        Gbar            { 150 * SOMA_A }    \      //      S
                        Ik              0       \                  //      A
                        Gk              0       \                  //      S
                        Xpower  1       \
                        Ypower  0       \
                        Zpower  0
 
                setupalpha Kdr_hip_traub91 X               \
                           {16e3 * (0.0351 + EREST_ACT)}   \  // AA
                           -16e3                           \  // AB
                           -1.0                            \  // AC
                           {-1.0 * (0.0351 + EREST_ACT) }  \  // AD
                           -0.005                          \  // AF
                           250                             \  // BA
                           0.0                             \  // BB
                           0.0                             \  // BC 
                           {-1.0 * (0.02 + EREST_ACT)}     \  // BD
                           0.04                               // BF
                
                This command sets up the X gate (activation gate) of Traub's
                delayed-rectifier potassium channel (Kdr_hip_traub91).
                SOMA_A and EREST_ACT are constants defined in the script
                file.  Note that the C value for the A table (AC) is -1; this
                can cause problems in general but does not cause any problems
                here (see below).

Notes:          For tabgate elements, which represent only a single gate, the
                 "gate" argument is ignored, but it should still be given as
                X, Y, or Z.  The setuptau command is similar to setupalpha,
                but uses the state variables tau and minf instead.

                If the alpha and beta rate constant of your channel cannot be
                described using the above equation, you must fill the tables
                with one of the other methods described in the tabchannel
                documentation, or The Book of GENESIS, Chapter 19 (2nd ed.).

                The rate equation described above has a removable singularity
                when C = -1 at the point x = -D (which is, unfortunately, a
                common case).  In this case the routine may generate
                inaccurate results due to roundoff errors.  We STRONGLY
                RECOMMEND that if you must use a C value of -1 you check the
                resulting activation curves by using Neurokit (in the "Edit
                Channel" mode) to see if they look reasonable.  If they do
                not then you will have to define the channel using a script
                function as mentioned above.  Such a function will result in
                a slower setup time for the channel but will be much more
                accurate.
See also: tabchannel , tabgate , setuptau , tweakalpha , tweaktau , Tables

24.125 setupgate

Routine Name:   setupgate

Description:    Sets up the internal tables of tabgate or table elements,
                based on a generic equation describing the values of the
                entries.

Usage:          setupgate channel-element table A B C D F -size n \
                -range min max -noalloc

                channel-element   This must be a tabgate or a table

                gate              The name of the table (must be
                                  alpha or beta for tabgates, "table" for
                                  table elements)

                A-F               Coefficients A to F of the table 
                                  equation (see below).

                -size n           Number of divisions in the table 
                                  (default = 3000).

                -range min max    Range of the table (default: min = -0.100; 
                                  max = 0.050).

                -noalloc          used to prevent allocation of the table
                                  when the table has already been allocated
                                  with a call to TABCREATE or a previous use
                                  of setupgate
                
                This routine makes it easy to set up the internal tables of
                tagate or table elements when the equations describing them
                are of the form:

                y(x) = (A + B * x) / (C + exp((x + D) / F))

                setupgate calls the TABCREATE action of the element
                to allocate tables with n divisions (n + 1 entries)
                representing x values from min to max.  It then evalutes the
                functions at these points to fill the tables.

Example:        see Scripts/neurokit/prototypes/newbulbchan.g

Notes:          The setupgate routine may not be used on tabchannels.
                The state equation described above has a removable singularity
                when C = -1 at the point x = -D.  common case).  In this case
                the routine may generate inaccurate results due to roundoff
                errors.
See also: setupalpha , setuptau , Tables

24.126 setuptau

Routine Name:   setuptau

Description:    Sets up A and B tables of voltage-dependent gates based on
                generic equations describing the form of the tau (time
                constant) and minf (steady state activation) state constants.

Usage:          setuptau channel-element gate AA AB AC AD AF BA BB BC BD BF \
                   -size n -range min max

                channel-element   This must be a tabgate or a tabchannel i.e.
                                  a voltage-dependent gate or channel with
                                  tabulated activation functions.

                gate              The name of the gate (must be X, Y, or Z).

                AA-AF             Coefficients A to F of the tau table 
                                  (see below).

                BA-BF             Coefficients A to F of the minf table 
                                  (see below).

                -size n           Number of divisions in the table 
                                  (default = 3000).

                -range min max    Range of the table (default: min = -0.100; 
                                  max = 0.050).

                This routine makes it easy to set up the A and B tables of 
                tabulated channels or gates (tabchannel or tabgate objects) 
                when the equations describing the state constants tau and 
                minf are of the form:

                y(x) = (A + B * x) / (C + exp((x + D) / F))

                Many standard channels have tau and minf parameters that can
                be cast into this form.  In these cases to set up the tables
                we can simply call setuptau with the parameter values as
                arguments to the function.  Since there are both tau and minf
                variables, we use the coefficients AA-AF to refer to the tau
                variable and BA-BF to refer to the minf variable.

                setuptau calls the TABCREATE action of the tabchannel or
                tabgate to allocate tables with n divisions (n + 1 entries)
                representing x values from min to max.  It then evalutes the
                functions at these points to fill the tables.

                The tables are by default set up in "no interpolation" mode, 
                which means that the process of finding the correct table
                value is simply a lookup operation.  With 3000 divisions in 
                the table (i.e. the table size is 3001) the lookup usually
                provides sufficient accuracy.  If not, you can override this 
                behavior; see the tabchannel documentation.  The range of the
                activation variable is between -0.100 and 0.050 by default.
                This is adequate for most voltage-dependent channels, but 
                can be overridden using the -range option.

Example:        see Scripts/neurokit/prototypes/newbulbchan.g

Notes:          For tabgate elements, which represent only a single gate, the
                 "gate" argument is ignored, but it should still be given as
                X, Y, or Z.  The setupalpha command is similar to setuptau,
                but uses the rate variables alpha and beta instead.

                If the tau and minf state constant of your channel cannot be
                described using the above equation, you must fill the tables
                with one of the other methods described in the tabchannel
                documentation, or The Book of GENESIS, Chapter 19 (2nd ed.).

                The state equation described above has a removable singularity
                when C = -1 at the point x = -D (which is, unfortunately, a
                common case).  In this case the routine may generate
                inaccurate results due to roundoff errors.  We STRONGLY
                RECOMMEND that if you must use a C value of -1 you check the
                resulting activation curves by using Neurokit (in the "Edit
                Channel" mode) to see if they look reasonable.  If they do
                not then you will have to define the channel using a script
                function as mentioned above.  Such a function will result in
                a slower setup time for the channel but will be much more
                accurate.
See also: tabchannel , tabgate , setupalpha , tweakalpha , tweaktau , Tables

24.127 sh

Routine Name:   sh

Description:    Issues operating system command from GENESIS shell.

Usage:          sh command

Example:        genesis > echo hello there
                hello there
                genesis > sh echo hello there
                hello there
                genesis > echo $DISPLAY
                ** Error - parse error
                genesis > sh echo $DISPLAY
                ** Error - parse error
                genesis > sh "echo $DISPLAY"
                babel.bbb.edu:0
                genesis >

Notes:          You can issue most operating system commands just by typing
                them at the GENESIS prompt (if the GENESIS interpreter does
                not recognize them as GENESIS commands, it automatically
                passes them on to the operating system for evaluation).
                However, if you have a GENESIS routine with the same name as
                an operating system command, you need to use the sh routine to
                send the command directly to the operating system.

See also:

24.128 showclocks

Routine Name:   showclocks

Description:    Displays currently defined clocks and their assigned values.

Usage:          showclocks

Example:        genesis > showclocks

                ACTIVE CLOCKS
                -------------
                [0] : 0.001
                [1] : 0.005

Notes:          Clock number 0 is the global simulation clock.  The default
                step size is 1.0 in whatever units you are using.
See also: useclock , setclock , getclock

24.129 showcommand

Routine Name:   showcommand

Description:    Displays name of C function invoked by a GENESIS routine.

Usage:          showcommand routine-name

Example:        genesis >  showcommand el
                'el' ==> 'do_construct_list'

Notes:          This command is useful when you are looking in the GENESIS
                source code for the function which implements a particular
                command.

See also:

24.130 showfield

Routine Name:   showfield

Description:    Displays value of field in data structure of specified element.

Usage:          showfield [pathname] [field] ... -all -basic -describe

                pathname        name of existing element; if wildcard path
                                specification, all elements referred to will
                                have their specified fields displayed
                                (default: current working element)

                field           field in element data structure for which to
                                display value; some special options for field:
                                 -basic displays basic information;
                                 -all displays basic info and all fields;
                                 -describe displays a description of the
                                    object from which the element was created;
                                 *  displays all fields;
                                 ** displays an extended listing of the element
                                    contents, including a description of the
                                    object from which the element was created

Example:        //showfield membrane potential, axial resistance
                showfield /cell/soma Vm Ra

                // show values of all soma fields
                showfield /cell/soma -a

                genesis >  showfield /neutral_test basic
                [ /neutral_test ]
                flags      = 0
                NOT FUNCTIONAL
                Clock [ 0 ] = 1.000000e+00
                0 incoming messages
                0 outgoing messages
                -----------------------------------------------------

Notes:          When a field is specified, the showfield routine is similar
                to getfield, but it displays its values rather than returning
                them.

                When the -describe option is given instead of a field name,
                the showfield routine is similar to the showobject routine.
See also: setfield , getfield , getfieldnames , showobject

24.131 showmsg

Routine Name:   showmsg

Description:    Displays list of incoming and outgoing messages of an element.

Usage:          showmsg  element

Example:        genesis > showmsg /cell/soma

                INCOMING MESSAGES
                MSG 0 from '/cell/soma/Na_squid_hh' type [0] 'CHANNEL' 
                        < Gk = 2.99968e-10 > < Ek = 0.045 >
                MSG 1 from '/cell/soma/K_squid_hh' type [0] 'CHANNEL'
                         < Gk = 1.03666e-08 > < Ek = -0.082 >

                OUTGOING MESSAGES
                MSG 0 to '/cell/soma/Na_squid_hh' type [0] 'VOLTAGE'
                        < Vm = -0.07 >
                MSG 1 to '/cell/soma/K_squid_hh' type [0] 'VOLTAGE'
                        < Vm = -0.07 >
                MSG 2 to '/data/voltage' type [0] 'PLOT' < data = -0.07 >
                        < name = volts > < color = red >

Notes:          showmsg is usually used interactively, when debugging or
                trying to understand a simulation, as it prints detailed
                information to the screen.  Use getmsg within a simulation
                script to return specific information.
See also: addmsg , deletemsg , getmsg

24.132 showobject

Routine Name:   showobject

Description:    Displays description of specified element type.

Usage:          showobject object-type

Example:        genesis > showobject compartment

                object               = compartment
                datatype             = compartment_type
                function             = Compartment()
                class                = [ membrane ] [ segment ] 
                size                 = 124 bytes
                author               = M.Wilson Caltech 6/88

                VALID ACTIONS
                        RESTORE2  SAVE2  SET  CHECK  RESET  PROCESS  INIT  

                VALID MESSAGES
                        [6] EREST                : Em 
                        [3] INJECT               : inject 
                        [2] AXIAL                : Vm 
                        [1] RAXIAL               : Ra Vm 
                        [0] CHANNEL              : Gk Ek 

                FIELDS
                  (ro)       name            compartment 
                  (ro)       index           0          
                  (ro)       object          &1688896   
                  (hidden)   flags                      
                  (hidden)   nextfields                 
                  (hidden)   extfields                  
                             x               0          
                             y               0          
                             z               0          
                  (hidden)   nmsgin                     
                  (hidden)   msgin                      
                  (hidden)   nmsgout                    
                  (hidden)   msgout                     
                  (hidden)   compositeobject            
                  (hidden)   componentof                
                  (hidden)   parent                     
                  (hidden)   child                      
                  (hidden)   next                       
                             activation      0          
                             Vm              0          
                             previous_state  0          
                             Im              0          
                             Em              0          
                             Rm              0          
                             Cm              0          
                             Ra              0          
                             inject          0          
                             dia             0          
                             len             0          
                             initVm          0          

                DESCRIPTION
                        Axially asymmetric compartment. Ra is located on
                one side of the compartment. This is slightly more
                computationally efficient than the symmetric
                counterpart.
                genesis >

Notes:          This routine returns many pieces of information about the
                object type, including the class, size, author, valid actions
                and messages, and data fields with the default values which
                are assigned when the object is instantiated as an element.
                If the field is not readable and writeable, the field is
                labeled (ro) if it is protected as read-only, and (hidden) if 
                it and its contents are hidden to the user.
See also: showfield , setfieldprot

24.133 silent

Routine Name:   silent

Description:    Sets and returns flag which supresses certain information
                displays to console.

Usage:          silence-status = silent [silent-flag]

                silent-flag     1 to suppress informative displays; 0 to
                                allow informative displays; 2 suppresses
                                startup messages.

Example:        genesis >  echo { silent }
                0
                genesis >  silent 1
                echo { silent }
                1

Notes:          Note that in the example above, the prompt is supressed after
                the silent flag is set to 1.  Various routines use the
                status of the silent flag to decide whether to print out
                certain informative messages.
                For
                example, the routines related to element stack (pushe, pope,
                stack) normally display the working element they deal with;
                if silent is > 0, these routines will not echo that
                information.  Within any SLI control structure, the flag
                behaves as if it were one greater.  For example, if the
                "step" command is used within a script function, the usual
                message reporting the number of steps and cpu time is
                supressed unless the flag is set to -1.
See also: debug

24.134 simdump

Routine name:   simdump

Description:    Dumps an entire simulation to a GENESIS script file.
                Should generally be invoked after calling the 
                'simobjdump' function to specify object fields.

                One of a family of functions for dumping and restoring
                simulations in their entirety, and merging overlapping
                simulations. The output of these functions is an ascii file
                readable by the GENESIS script interpreter.  However, this
                ascii file uses 'simundump' to restore field values, which is
                efficient but not very human-friendly.

                Since the output of simdump is GENESIS script file, one
                can dump various parts of a simulation into different files,
                and read them back in separately, or read them into a different
                simulation, and so on.

                Simdump files do quasi-intelligent 'merging' of files with
                existing simulations. If an element is already there, it
                will content itself with updating the field values and
                adding missing messages. By default it will avoid duplicating
                existing messages. It also has a provision for
                ignoring orphan elements, whose parents are not defined. These
                options are activated by the initdump command.


Usage:          simdump filename -path path -tree tree -messages -all
                        
                filename: The name of the output dump file.

                -path path: specifies a wildcard path of elements to
                        be dumped. This option can be used repeatedly to put
                        several different bits of the simulation into the
                        file. The same effect could be achieved by using
                        the extended wildcard specification.

                -tree tree: A currently disabled option for getting the
                        wildcard path from an xtree.

                -messages: A currently disabled option.

                -all : Tells simdump to dump the entire simulation.


Example:        See below for an example of a simple and a complex dump of
                a simulation plus interface.
                

Notes:          In theory it should be possible to use simdump on its own,
                without invoking simobjdump or initdump. In this situation, 
                the command assumes that all fields of the objects are to
                be dumped. This is inefficient. Worse, it causes problems
                because fields can take values that should not be reloaded
                into them. Pointers are a good example. Also see below about
                what happens with Xodus.

                Simdump always saves files in 'append' mode. This means that
                if you accidently use the same filename as an existing .g file,
                the original won't be destroyed, and you can edit the file
                to extract the dumped part and the original.
                
                Xodus poses lots of problems for simdump, because Xodus
                objects do not always behave cleanly. For example,
                Xodus objects often have default field values like 'nil' 
                which are not valid when trying to reload the dumpfile. It
                is necessary to exclude the offending fields by using
                simobjdump to select well-behaved fields for the dump.
                Furthermore, there is no 'field' to determine whether an
                xform is displayed or not, so the forms won't appear until
                explicity 'shown'. There are various other annoyances, like
                things not updating when you expect them to. For this reason,
                simdump will need help if you are trying to dump an interface.

                Simdump will happily dump the entire contents of a 1-Megabyte
                xplot or table. This gives a valid, but enormous dumpfile.
                If this is not desirable, simobjdump allows one to specify
                the -noDUMP option. See simobjdump documentation.

                A few objects will dump too much information for the
                parser to handle as part of a single command. This is only
                likely to occur in very rare situations.

                The hsolver can be dumped, but its fields must be restricted
                to the path. The solver will need to be re-initialized
                when trying to restore the simulation. It is better to
                just rebuild the whole hsolver from scratch.

                In general, cell models are much more compactly specified
                by the .p files than by the simdump files. It is also much
                more user-friendly that way.

                The long-bewailed problem with re-entrant parsers means that
                the generated script file cannot be read in on a mouse-click.
                You will have to type in a command to load the script file.

Example:

This example consists of two files: a demo simulation file called "dumpdemo.g",
and a file "savefunc.g" with two versions of simulation dumping functions.
Cut out the scripts to the appropriate files. Run dumpdemo, which is a 
little compartmental model with interface. Save using the simple and complex
versions of the dumping interface. Examine the resulting dumpfiles using
your favourite editor, and then reload them to see what happens.

================ Cut here for file "dumpdemo.g" =============================

//genesis

setclock 0 0.001

include savefunc.g

create neutral /a
create compartment /a/compt
setfield ^ Ra 1 Cm 1 Rm 1

copy /a /b

addmsg /a/compt /b/compt AXIAL Vm
addmsg /b/compt /a/compt RAXIAL Ra Vm

create xform /form
create xgraph /form/graph -ymax 0.5 -xmax 5
create xplot /form/graph/plot -fg red
create xbutton /form/simple_save -script "do_simple_save"
create xbutton /form/complex_save -script "do_complex_save"
create xbutton /form/quit -script quit
xshow /form

addmsg /b/compt /form/graph/plot PLOT Vm *Vm *red

setfield /a/compt inject 1

reset

step 5 -t

============== Cut here for file savefunc.g ================================


//genesis

// This function saves only the structure of the simulation. None
// of the interface objects will be saved.
function do_simple_save
        // compartments are well-behaved, so we can get away with
        // dumping all compartment fields by default
        // Here we illustrate two ways of dumping multiple paths
        simdump simple_dump.g -path /a -path /a/## -path "/b,/b/##"
        echo "Simple dump done to file: simple_dump.g"
end

// This function saves everything about the simulation. It has
// to jump through many hoops to deal with Xodus oddness.
function do_complex_save
        str filename = "complex_dump.g"

        // Write out some general info for the dumpfile
    openfile {filename} "w"
    writefile {filename} "//genesis"
    writefile {filename} {"// Saved on " @ {getdate}}
    writefile {filename} "setclock 0 0.001"
    writefile {filename} "include savefunc.g"
        closefile {filename}

        // Specify which fields of the Xodus objects we want to save
        simobjdump xform xgeom ygeom wgeom hgeom
        simobjdump xaxis script
        simobjdump xshape script
        simobjdump xgraph xmin ymin xmax ymax xgeom ygeom wgeom hgeom
        simobjdump xplot npts
        simobjdump xbutton script
        simobjdump xdialog script value
        
        // Dump the entire simulation
        simdump {filename} -all

        // We're not done yet: we need to help the interface get back
        // to its original state.
    openfile {filename} "a"
    writefile {filename} "xshow /form"
    writefile {filename} \
        "setfield /form/graph/plot npts "{getfield /form/graph/plot npts}
    writefile {filename} "xupdate /form/graph"
        closefile {filename}

        echo "Complete dump done to file: "{filename}
end

=============================================================================
See also: initdump , simobjdump , simundump .

24.135 simobjdump

Routine name:   simobjdump

Description:    Sets up the format for dumping and reading objects to a file
                using simdump.

Usage:          simobjdump object ... -coords -default -noDUMP
                        
                object:  The name of the GENESIS object class

                ... :    The fields to be dumped for this object

                -coords: Dump the x y z coords. 

                -default: Use all the fields defined for the object. This
                        will also happen if you call simobjdump with no
                        arguments, or if you don't call simobjdump at all.
                
                -noDUMP: A few GENESIS object classes, such as tables, have
                        a DUMP action which does object-specific things.
                        noDUMP inactivates this DUMP action. For example, in
                        a table, the DUMP action would normally dump the entire
                        contents of the table. noDUMP prevents this from 
                        happening.

Example:        Here is a little dumpfile using simobjdump that recreates a
                simple 2-compartment model. In this case the simobjdump
                command was not used at all before the simdump, so the
                simdump command caused the entire set of fields for the
                relevent classes (neutrals and compartments) to be specified
                for the dumpfile.

                ============================================================
                //genesis

                initdump -version 3
                simobjdump neutral
                simobjdump compartment activation Vm previous_state \
                        Im Em Rm Cm Ra inject dia len initVm
                simundump neutral /a 0
                simundump compartment /a/compt 0 0 0.6632976405 0.6632942696 \
                        -0.3333315551 0 1 1 1 1 0 0 0
                simundump neutral /b 0
                simundump compartment /b/compt 0 0 0.3299660931 0.3299627243 \
                        0.3333349228 0 1 1 1 0 0 0 0
                addmsg /b/compt /a/compt RAXIAL Ra Vm 
                addmsg /a/compt /b/compt AXIAL Vm 
                enddump
                // End of dump

                ============================================================
                
Notes:          In theory it should be possible to use simdump on its own,
                without invoking simobjdump or initdump. In this situation, 
                the command assumes that all fields of the objects are to
                be dumped. This is inefficient. Worse, it causes problems
                because fields can take values that should not be reloaded
                into them. Pointers are a good example. Also see below about
                what happens with Xodus.

                Simdump will happily dump the entire contents of a 1-Megabyte
                xplot or table. This gives a valid, but enormous dumpfile.
                If this is not desirable, simobjdump allows one to specify
                the -noDUMP option.
See also: initdump , simdump , simundump .

24.136 simundump

Routine name:   simundump

Description:    Creates an element and assigns values to its fields.
                Simundump is not really a human-use command. It only
                occurs in dumpfiles, and is always preceeded by initdump
                and simobjdump, and followed up by enddump at the end of
                the file.

Usage:          simundump object element ... -tree tree x y z

                object: The object class to be created

                element: The path of the new element

                ... : Fields values of the element. The field names are
                specified earlier in the file by the simobjdump command.

                -tree tree: A currently disabled option for getting the
                        wildcard path from an xtree.

Example:        Here is a little dumpfile using simundump that recreates a
                simple 2-compartment model.

                ============================================================
                //genesis

                initdump -version 3
                simobjdump neutral
                simobjdump compartment activation Vm previous_state \
                        Im Em Rm Cm Ra inject dia len initVm
                simundump neutral /a 0
                simundump compartment /a/compt 0 0 0.6632976405 0.6632942696 \
                        -0.3333315551 0 1 1 1 1 0 0 0
                simundump neutral /b 0
                simundump compartment /b/compt 0 0 0.3299660931 0.3299627243 \
                        0.3333349228 0 1 1 1 0 0 0 0
                addmsg /b/compt /a/compt RAXIAL Ra Vm 
                addmsg /a/compt /b/compt AXIAL Vm 
                enddump
                // End of dump

                ============================================================
Notes:          
                Simundump does quasi-intelligent 'merging' of files with
                existing simulations. If an element is already there, it
                will content itself with updating the field values and
                adding missing messages. It won't try to add messages to
                missing elements, and won't complain: it assumes that you
                meant to leave them out. It also has a provision for
                ignoring orphan elements, whose parents are not defined. These
                options are activated by the initdump command.

                In current versions of simdump/undump, the first field argument
                to simundump is always the 'flags' field of the element (even
                if it not requested). This restores the clocks, and other
                status attributes of elements.
        
                Xodus poses lots of problems for simundump, because Xodus
                objects do not always behave cleanly. For example,
                Xodus objects often have default field values like 'nil' 
                which are not valid when trying to reload the dumpfile. It
                is necessary to exclude the offending fields by using
                simobjdump to select well-behaved fields for the dump.
                Furthermore, there is no 'field' to determine whether an
                xform is displayed or not, so the forms won't appear until
                explicity 'shown'. There are various other annoyances, like
                things not updating when you expect them to. For this reason,
                simundump will need help if you are trying to reload an
                interface.
See also: initdump , simdump , simobjdump

24.137 sin

Routine Name:   sin

Description:    Returns sine for given angle (specified in radians).

Usage:          sine = {sin angle-in-radians}

Example:        float s
                s = {sin {3.14159/4}}

Notes:          
See also: asin

24.138 sqrt

Routine Name:   sqrt

Description:    Returns square root of positive number.

Usage:          square-root = {sqrt positive-number}

Example:        genesis > echo {sqrt 2}
                1.414213538
                genesis > echo {sqrt 0}
                0
                
Notes:          

24.139 stack

Routine Name:   stack

Description:    Displays list of elements on working element stack.

Usage:          stack

Example:        genesis >  pwe
                /
                genesis >  pushe /neuron1
                /neuron1
                genesis >  pushe /neuron2
                /neuron2
                genesis >  stack
                /
                /neuron1

Notes:          The stack routine prints out the current contents of the
                element stack (the stack used to store paths pushed and 'pop'ed
                from the stack using the GENESIS pushe and pope routines).

                The stacked elements are listed in the reverse order in which
                they will be 'pop'ed (i.e., the last element listed will be
                the first 'pop'ed).
See also: pushe , pope

24.140 step

Routine Name:   step

Description:    Advances the simulation by one or more steps.

Usage:          step [steps-or-time] -time -verbose -background

                steps           number of steps to advance simulation

                time            time by which to advance simulation

                -time           interpret the first argument as time

                -verbose        use verbose mode (display status of simulation
                                at each step)

                -background     run simulation as background process, and
                                return user to GENESIS shell

Example:        step 100
                step 5 -v
                step 25.4 -t -b

                genesis >  step
                time = 1.000000 ; step = 1
                completed 1 steps in 0.000000 cpu seconds

Notes:          When run in the background, the simulation is still sensitive
                to ^C.  Generating a ^C interrupt can cause the simulation to
                abnormally terminate a step giving erroneous results.  To halt
                an simulation in progress, use the stop routine.

                Only one simulation can be started at any given time. A
                background simulation must already be running. The showjobs
                routine will display this status (as the Simulate function).
See also: stop , showstat, reset , check

24.141 stop

Routine Name:   stop

Description:    Completes current simulation step, stopping simulation.

Usage:          stop

Example:        stop

Notes:          After cleanly stopping the simulation, the routine returns you
                to the GENESIS shell.  The stop routine is NOT equivalent to
                interrupting with ^C, which leaves the simulation in an
                unknown state -- stop completes the current step in progress.
See also: step , abort

24.142 strcat

Routine Name:   strcat

Description:    Returns new string as concatenation of two strings.

Usage:          new-string = {strcat s1 s2}

Example:        genesis >  echo { strcat "bad" "dog" }
                baddog

Notes:          Unlike the C function of the same name, this routine does not
                modify the string s1.

                You can also concatenate strings using the ``@'' operator.

24.143 strcmp

Routine Name:   strcmp

Description:    Compares two strings.

Usage:          compare-flag = {strcmp s1 s2}

                compare-flag    returned as 0 if strings are identical; 1 if
                                s1 is "greater than" s2; -1 if s1 is "less
                                than" s2

Example:        genesis >  echo { strcmp "hi" "hi" }
                0
                genesis >  echo { strcmp "hi" "he"}
                1
                genesis >  echo { strcmp "hi" "ho"}
                -1

Notes:          "Greater than" means "later in the standard ASCII sequence".

                You can compare strings up to a specified character using the
                strncmp routine.
See also: strcat , strncmp , strlen , substring , findchar

24.144 strlen

Routine Name:   strlen

Description:    Returns length of string in number of characters.

Usage:          length-int = {strlen string}

Example:        genesis >  echo { strlen "string" }
                6
                genesis >  echo { strlen "hi there" }
                8

Notes:          Blanks, TABs, and so forth are included in the count.
See also: strcat , strcmp , strlen , substring , findchar

24.145 strncmp

Routine Name:   strncmp

Description:    Compares two strings up to specified number of characters.

Usage:          compare-flag = {strncmp s1 s2 n}

                compare-flag    returned as 0 if strings are identical;
                                1 if s1 is "greater than" s2;
                                -1 if s1 is "less than" s2

                n               number of characters up to which to make
                                comparison

Example:        genesis >  echo { strncmp "hip" "hit" 2 }
                0
                genesis >  echo { strncmp "hip" "hit" 3 }
                -1

Notes:          The strncmp routine is like the strcmp routine, but restricted
                to a certain number of characters for comparison.

                "Greater than" means "later in the standard ASCII sequence".
See also: strcat , strcmp , strlen , substring , findchar

24.146 strsub

Routine Name:   strsub

Description:    Returns a string with one substring replaced by another

Usage:          strsub string old-substring new-substring [-all]

Example:        genesis > echo {strsub "old dogs chase old cats" old young}
                young dogs chase old cats

                genesis > {strsub "old dogs chase old cats" old young -all}
                young dogs chase young cats
Notes:          

24.147 substring

Routine Name:   substring

Description:    Returns part of original string as new substring.

Usage:          new-string = {substring string startindex [endindex]}

                new-string      returned as new string created

                string          original string
        
                startindex      integer indicating position of first character
                                in string to include in new string

                endindex        integer indicating position of final character
                                in string to include in new string (default:
                                final character in string)

Example:        genesis >  echo { substring "0123456789" 3 7 }
                34567
                genesis >  echo { substring "0123456789" 3 }
                3456789

Notes:          The substring routine can be useful in conjunction with other
                routines (e.g., getpath) for constructing names based on part
                of an element path name.
See also: strcat , strcmp , strncmp , strlen , findchar

24.148 swapdump

Routine name:   swapdump

Description:    Mirrors initialization data for doing simulation dumps
                using simdump.  Consider this situation: we have a dumpfile
                that we want to read in, but at the same time we have
                laboriously defined (using simobjdump) our favourite sets of
                fields for all objects. Unfortunately the dumpfile has its own
                set of simobjdumps, which will overwrite ours. So we use
                swapdump, which puts our own simobjumps into storage, while we
                read in the dumpfile.  Then we can do swapdump again to go back
                to our original set of simobjdumps.

Usage:          swapdump

Example:        Complicated model is already set up, with its own preferences
                for simobjdump. Now we want to read in a dumpfile called foo.g.

                ...
                swapdump // put original simobjdump preferences into storage
                include foo.g // read in dumpfile which has its own simobjdumps
                swapdump // restore original simobjdump preferences
                ...
                simdump bar.g -all      // Save combined model using original
                                        // simobjdump preferences.
Notes:          
See also: initdump , simdump , simobjdump , simundump

24.149 syndelay

Routine Name:   syndelay

Description:    This command is used to set or to add a small "synaptic" 
                component to the delay fields of synapses.  It is useful 
                for when cells are very close together and thus where 
                planardelay or volumedelay give unrealistically small
                delays.

Usage:          syndelay path delay                        \
                -add                                       \
                -uniform scale                             \
                -gaussian stdev maxdev                     \
                -exponential mid max                       \
                -absoluterandom

                path  A wildcarded list of elements which must be synchans or 
                        objects derived from synchan.  

                delay -- This sets all the synaptic delays in question to be
                        equal to "delay", or adds "delay" to the existing
                        delay if the -add option is selected.
5
                -add  This option causes the delays to be added to the 
                        preexisting delays in the synapses instead of
                        overwriting them.  

                The next four options are used to add random components to the
                delay.  How these random components are added to the delays is 
                explained below.

                -uniform scale  -- This option gives a random number taken 
                        from a uniform distribution in the range 
                        {-scale, scale}.

                -gaussian stdev maxdev  -- This option gives a random number
                        taken from a gaussian distribution centered on zero,
                        with a standard deviation equal to "stdev" and with
                        a maximum value of "maxdev".  The maximum value is
                        used to limit the random component to a given range.

                -exponential mid max  -- This option gives a random number
                        taken from an exponential distribution with a 
                        minimum value of zero, a 1/e point of "mid" and a 
                        maximum value of "max".  This is mainly for backwards
                        compatibility with genesis 1.4.

                -absoluterandom  This option alters the way the random number
                        is combined with the nominal delay to give the actual
                        delay, as described below.

                Once a random component has been created for a given delay, 
                it is used to set the delay as follows.  If the 
                -absoluterandom option has not been selected the delay is set 
                to be:

                final_delay = delay + (delay * random_number)

                Whereas if the -absoluterandom option has been selected then
                we have

                final_delay = delay + random_number

                Thus the default is to have the amount of randomness as a 
                constant proportion of the delay value.

Example:        syndelay /cell[]/apical_dend/Ex_chan 0.001 \
                            -add -gaussian 0.1 0.3 

                This command will add a small delay to the delay fields in the
                synapses in /cell[]/soma/apical_dend/Ex_chan.  The "synaptic"
                delay added will be 1 millisecond plus a random component.

Notes:          The delays are never allowed to go negative even if a large
                negative random component is added.  Negative delays are set
                to zero.

                If the -add option is chosen, the random component modifies 
                only the delay added and not the total delay.
See also: planardelay , volumeconnect , volumeweight , syndelay ; Chapter 18 of the Book of GENESIS (2nd ed.) has a lengthy discussion on this and related commands.

24.150 tan

Routine Name:   tan

Description:    Returns tangent for given angle (specified in radians).

Usage:          tangent = {tan angle-in-radians}

Example:        float t = {tan {3.14159/4}}

Notes:          
See also: atan

24.151 trunc

Routine Name:   trunc

Description:    Returns integer part of number.

Usage:          integer = {trunc number}

Example:        genesis >  echo { trunc 5.999 }
                5

Notes:          This routine converts any number to an integer by deleting
                the decimal part without any rounding.
See also: round

24.152 tweakalpha

Routine Name:   tweakalpha

Description:    Allows one to fill the A and B tables of a tabchannel
                with values of the rate constants alpha and beta, and
                then convert them to the proper values A = alpha and
                B = alpha + beta.

Usage:          tweakalpha channel-element gate
                gate    X, Y, or Z

Example:        tweakalpha K_mit_usb X

Notes:
See also: tabchannel , tweaktau

24.153 tweaktau

Routine Name:   tweaktau

Description:    Allows one to fill the A table of a tabchannel with the
                activation time constant tau, and the B table with the steady
                state activation m_inf, and then convert the tables to the
                proper values A = alpha and B = alpha + beta.

Usage:          tweaktau channel-element gate
                gate    X, Y, or Z

Example:        tweaktau Na_rat_smsnn X

Notes:
See also: tabchannel , tweakalpha

24.154 useclock

Routine Name:   useclock

Description:    Specifies which clock an element should use during simulation.

Usage:          useclock path clock-number

Example:        useclock /graphform/Vmgraph 1

Notes:          The useclock routine specifies which clock is to be used by a
                GENESIS element.  You might use it, for instance, to allow
                some elements to be updated at greater intervals than the
                basic simulation step.
See also: showclocks , setclock , getclock

24.155 version

Routine Name:   version

Description:    Returns the GENESIS version number.

Usage:          version_number = {version}

Example:
                if ({version} < 2.0)
                    echo "This simulation requires version 2.0 or later"
                    exit
                end

Notes:  

See also:       

24.156 volumeconnect

Routine Name:   volumeconnect

Description:    Establishes synaptic connections between groups of elements
                based on the x-y-z positions of the elements.  This routine 
                sets up the connections by adding SPIKE messages between the 
                source and destination objects.

Usage:          volumeconnect source_elements destination_elements \
                -relative \
                -sourcemask {box, ellipsoid} x1 y1 z1 x2 y2 z2 \
                -sourcehole {box, ellipsoid} x1 y1 z1 x2 y2 z2 \
                -destmask   {box, ellipsoid} x1 y1 z1 x2 y2 z2 \
                -desthole   {box, ellipsoid} x1 y1 z1 x2 y2 z2 \
                -probability p

                source_elements  A wildcarded list of elements which are the 
                        sources of the SPIKE messages.  These must be of
                        class "spiking" and are usually spikegen or 
                        randomspike objects.

                destination_elements  A wildcarded list of elements which are
                        the destinations of the SPIKE messages.  These must  
                        be synchans or objects derived from synchan.

                -relative This option means that connections will be set up
                        based on the locations of destination objects
                        relative to source objects.  If this option is not
                        selected, the absolute locations of source and
                        destination elements will be used to determine
                        which connections are to be set up.

                -sourcemask {box, ellipsoid} x1 y1 z1 x2 y2 z2 -- This
                        specifies a rectangular or ellipsoidal region from
                        which source elements are to be taken.  If the "box"
                        option is used, then x1, y1, and z1 are the minimum
                        x, y, and z values of the region while x2, y2, and
                        z2 are the maximum x, y, and z values of the
                        region.  If the "ellipsoid" option is used, then the
                        source region is an ellipsoid with x1, y1 and z1
                        representing the center of the ellipsoid while x2,
                        y2, and z2 represent the lengths of the principal
                        axes in the x, y, and z directions respectively.
                        Note that to choose a spherical region x2, y2, and
                        z2 must be equal.  Note also that one or the other
                        of {box, ellipsoid} MUST be chosen; leaving both of
                        them out will generate an error.  Finally, one can
                        choose multiple source regions by having multiple
                        -sourcemask options.  The same conventions are
                        followed for the next three options.  

                -sourcehole {box, ellipsoid} x1 y1 z1 x2 y2 z2  -- This 
                        specifies a rectangular or elliptical region NOT to 
                        include in the source region(s).  You can exclude 
                        multiple regions by having multiple -sourcehole 
                        options.

                -destmask {box, ellipsoid} x1 y1 z1 x2 y2 z2  -- This 
                        specifies a rectangular or elliptical region to which 
                        SPIKE messages will be sent.

                -desthole {box, ellipsoid} x1 y1 z1 x2 y2 z2  -- This 
                        specifies a rectangular or elliptical region NOT to 
                        include in the destination region(s). 

                -probability p  -- This option causes connections to be 
                        made with a probability p, which must be in the
                        range [0,1].  This allows probabilistically-connected
                        networks to be set up.

Example:        Say we want to connect the spike generating-region of a group
                of cells with excitatory synapses on the apical dendritic 
                compartments of the same group of cells, without connecting 
                any cell to itself.  We could do this:

                volumeconnect /cell[]/soma/spike                 \
                              /cell[]/apical_dend/exc_syn        \
                              -relative                          \
                              -sourcemask box -1 -1 -1  1  1  1  \
                              -sourcehole box -10e-6 -10e-6 -1   \
                                               10e-6  10e-6  1   \
                              -destmask   box -1 -1 -1  1  1  1

                Note that here we are excluding a region 10 microns square in
                the x and y direction (but essentially unlimited in the z
                direction) so that cells don't connect to themselves.  Here
                I'm assuming we're using SI units.  This could also have
                been done with planarconnect.  Note also that the usual way
                to specify "all cells in a region" is to give source or
                destination regions using -sourcemask or -destmask with
                limits far greater than the entire extent of all the
                elements in the region.

Notes:          This routine is almost identical with planarconnect except 
                that it uses the positions of elements in three dimensions 
                to specify whether connections are made or not, whereas
                planarconnect uses only the x and y dimensions.

                The weights and delays of the connections set up by this   
                command are typically specified using the volumeweight and 
                volumedelay commands, although they can be set up by hand.
See also: planarconnect , volumeweight , volumedelay ; Chapter 18 of the Book of GENESIS (2nd ed.) has a lengthy discussion on this and related commands.

24.157 volumedelay

Routine Name:   volumedelay

Description:    Sets the delay fields on groups of synapses between
                specified lists of elements.  Most often used to set
                delays on groups of synapses that have been set up
                by calling the "volumeconnect" command.  This function
                can assign groups of synapses to a fixed delay, can
                assign delays in proportion to the distances between
                pre- and postsynaptic elements, and can add various
                types of randomness to delay values.

Usage:          volumedelay sourcepath [destination_path]  \
                -fixed delay                               \
                -radial conduction_velocity                \
                -add                                       \
                -uniform scale                             \
                -gaussian stdev maxdev                     \
                -exponential mid max                       \
                -absoluterandom

                sourcepath  A wildcarded list of elements which are the 
                        sources of the SPIKE messages connecting the
                        pre- and postsynaptic elements (i.e. the presynaptic
                        elements).  These must be of class "spiking" and are 
                        usually spikegen or randomspike objects.

                destination_path  A wildcarded list of elements which must be
                        synchans or objects derived from synchan.  If this
                        (optional) argument is given, only the delays between 
                        the given set of pre- and postsynaptic elements will
                        be set by this command.  If this argument is not
                        given, then all the synapses receiving SPIKE messages
                        from the presynaptic elements will have their delays
                        set by this command.  NOTE: this optional argument is 
                        new and is not documented in the Book of Genesis.

                -fixed delay  -- This option sets all the synaptic delays in
                        question to be equal to "delay".

                -radial conduction_velocity  -- This option sets the synaptic 
                        delays in question to be proportional to
                        the distance between the source and destination 
                        elements according to the equation:

                        delay = radial_distance / conduction_velocity

                        Where conduction_velocity is usually measured in
                        meters/sec (SI units).  "conduction_velocity"
                        represents the conduction velocity of the 
                        (hypothetical) axon that the spikes travel down.
                        For volumedelay, the distance is measured as:
 
                        distance = 
                          sqrt((x_src - x_dest)^2 + 
                               (y_src - y_dest)^2 + 
                               (z_src - z_dest)^2)
 
                        where x_src is the x component of the source element,
                        x_dest is the x component of the destination element,
                        and so on. 

                -add  This option causes the computed delays to be added to 
                        the preexisting delays in the synapses instead of
                        overwriting them.  This is useful when adding small 
                        synaptic delays, among other uses.  

                The next four options are used to add random components to the
                delays established using the -fixed or -decay options.  How
                these random components are added to the delays is explained
                below.

                -uniform scale  -- This option gives a random number taken 
                        from a uniform distribution in the range 
                        {-scale, scale}.

                -gaussian stdev maxdev  -- This option gives a random number
                        taken from a gaussian distribution centered on zero,
                        with a standard deviation equal to "stdev" and with
                        a maximum value of "maxdev".  The maximum value is
                        used to limit the random component to a given range.

                -exponential mid max  -- This option gives a random number
                        taken from an exponential distribution with a 
                        minimum value of zero, a 1/e point of "mid" and a 
                        maximum value of "max".  This is mainly for backwards
                        compatibility with genesis 1.4.

                -absoluterandom  This option alters the way the random number
                        is combined with the nominal delay to give the actual
                        delay, as described below.

                Once a random component has been created for a given delay, 
                it is used to set the delay as follows.  If the 
                -absoluterandom option has not been selected the delay is set 
                to be:

                final_delay = delay + (delay * random_number)

                Whereas if the -absoluterandom option has been selected then
                we have

                final_delay = delay + random_number

                Thus the default is to have the amount of randomness as a 
                constant proportion of the delay value.

Example:        [modified from the Orient_tut simulation:]

                volumedelay /retina/recplane/rec[]/input \
                            -radial {CABLE_VEL}          \
                            -gaussian 0.1 0.3

                This command will set the size of the delays of synapses 
                that are receiving their inputs from 
                /retina/recplane/rec[]/input.  It gives delays equal to the
                radial distance between elements divided by the conduction
                velocity (CABLE_VEL).  It also specifies that gaussian noise 
                be added to the delays with a mean value of 0.1 (which 
                represents 10% of the original delay, since -absoluterandom 
                has not been selected) and a maximum value of 0.3 (which is 
                30% of the original delay value).

Notes:          The "destination_path" optional argument is new and is not
                documented in the Book of GENESIS.

                This routine calculates distance using the x, y, and z
                coordinates of the element positions and is thus more 
                realistic than planardelay, which only uses the x and y
                directions.  In general, we encourage users to use this
                function instead of planardelay, which is mainly provided
                for backwards compatibility with genesis 1.4.

                The delays are never allowed to go negative even if a large
                negative random component is added.  Negative delays are set
                to zero.

                If the -add option is chosen, the random component modifies 
                only the delay added and not the total delay.
See also: planardelay , volumeconnect , volumeweight , syndelay ; Chapter 18 of the Book of GENESIS (2nd ed.) has a lengthy discussion on this and related commands.

24.158 volumeweight

Routine Name:   volumeweight

Description:    Sets the weight fields on groups of synapses between
                specified lists of elements.  Most often used to set
                weights on groups of synapses that have been set up
                by calling the "volumeconnect" command.  This function
                can assign groups of synapses to a fixed weight, can
                assign weights in proportion to the distances between
                pre- and postsynaptic elements, and can add various
                types of randomness to weight values.

Usage:          volumeweight sourcepath [destination_path] \
                -fixed weight                              \
                -decay decay_rate max_weight min_weight    \
                -uniform scale                             \
                -gaussian stdev maxdev                     \
                -exponential mid max                       \
                -absoluterandom

                sourcepath  A wildcarded list of elements which are the 
                        sources of the SPIKE messages connecting the
                        pre- and postsynaptic elements (i.e. the presynaptic
                        elements).  These must be of class "spiking" and are 
                        usually spikegen or randomspike objects.

                destination_path  A wildcarded list of elements which must be
                        synchans or objects derived from synchan.  If this
                        (optional) argument is given, only the weights between 
                        the given set of pre- and postsynaptic elements will
                        be set by this command.  If this argument is not
                        given, then all the synapses receiving SPIKE messages
                        from the presynaptic elements will have their weights
                        set by this command.  NOTE: this optional argument is 
                        new and is not documented in the Book of GENESIS.

                -fixed weight  -- This option sets all the synaptic weights in
                        question to be equal to "weight".

                -decay decay_rate max_weight min_weight  -- This option sets
                        the synaptic weights in question to be proportional to
                        the distance between the source and destination 
                        elements according to the equation:

                        weight = (max_weight - min_weight) * 
                          exp(-decay_rate * distance) + min_weight

                        For volumeweight, the distance is measured as:

                        distance = 
                          sqrt((x_src - x_dest)^2 + 
                               (y_src - y_dest)^2 + 
                               (z_src - z_dest)^2)

                        where x_src is the x component of the source element,
                        x_dest is the x component of the destination element,
                        and so on. 

                The next four options are used to add random components to the
                weights established using the -fixed or -decay options.  How
                these random components are added to the weights is explained
                below.

                -uniform scale  -- This option gives a random number taken 
                        from a uniform distribution in the range 
                        {-scale, scale}.

                -gaussian stdev maxdev  -- This option gives a random number
                        taken from a gaussian distribution centered on zero,
                        with a standard deviation equal to "stdev" and with
                        a maximum value of "maxdev".  The maximum value is
                        used to limit the random component to a given range.

                -exponential mid max  -- This option gives a random number
                        taken from an exponential distribution with a 
                        minimum value of zero, a 1/e point of "mid" and a 
                        maximum value of "max".  This is mainly for backwards
                        compatibility with genesis 1.4.

                -absoluterandom  This option alters the way the random number
                        is combined with the nominal weight to give the actual
                        weight, as described below.

                Once a random component has been created for a given weight, 
                it is used to set the weight as follows.  If the 
                -absoluterandom option has not been selected the weight is set 
                to be:

                final_weight = weight + (weight * random_number)

                Whereas if the -absoluterandom option has been selected then
                we have

                final_weight = weight + random_number

                Thus the default is to have the amount of randomness as a 
                constant proportion of the weight value.

Example:        [modified from the Orient_tut simulation:]

                volumeweight /retina/recplane/rec[]/input \
                             -decay 0.5 10.0 0.1          \
                             -gaussian 0.1 0.3

                This command will set the size of the weights of synapses 
                that are receiving their inputs from 
                /retina/recplane/rec[]/input.  It gives exponentially decaying
                weights with a maximum size of 10.0, a minimum size of 0.1,
                and a decay rate of 0.5.  It also specifies that gaussian
                noise be added to the weights with a mean value of 0.1 
                (which represents 10% of the original weight, since 
                -absoluterandom has not been selected) and a maximum value of
                0.3 (which is 30% of the original weight value).

Notes:          The "destination_path" optional argument is new and is not
                documented in the Book of Genesis.

                This routine calculates distance using the x, y, and z
                coordinates of the element positions and is thus more 
                realistic than planarweight, which only uses the x and y
                directions.  In general, we encourage users to use this
                function instead of planarweight, which is mainly provided
                for backwards compatibility with genesis 1.4.

                The weights are never allowed to go negative even if a large
                negative random component is added.  Negative weights are set
                to zero.

                The options -fixed and -decay are mutually exclusive.  The 
                different random options -uniform, -gaussian, and -exponential
                are also mutually exclusive.
See also: planarweight , volumeconnect , volumedelay ; Chapter 18 of the Book of GENESIS (2nd ed.) has a lengthy discussion on this and related commands.

24.159 where

Routine Name:   where

Description:    Returns name of operating-system directory in which specified
                file is located.

Usage:          where filename

                filename        name of file to search for (must be actual
                                name; where does not add a .g if you do not
                                explicitly supply it, and does not accept
                                wildcarded names)

Example:        genesis >  where mysim.g
                'mysim.g' found in .

                genesis >  where fooby
                could not find 'fooby' in . /usr/genesis/startup

Notes:          The where routine searches the script path list (as specified
                in the operating system environmental variable SIMPATH) and
                reports the first instance found of the specified file.

24.160 writecell

Routine Name:   writecell

Description:    Writes parameters of neuron to a cell parameter file in a
                standard format.

Usage:          writecell filename cellname -cartesian -polar -relative
                        -absolute -syndens -syncond -author author

                filename                name to give cell descriptor file
                                        (should end with extension .p)

                cellname                name of GENESIS cell for which you
                                        want to store description

                author                  who made the cell

                default options         -cartesian -relative -syndens

Example:        writecell  newmitral.p  /mitral 

Notes:          This cell-writing routine is the counterpart of the readcell
                routine.  writecell takes a multicompartment neuron set up
                in GENESIS and writes it in the neuron descriptor format to
                a file.  Options allow you to specify whether the compartment
                coordinates are cartesion or polar, and whether they are
                given in absolute units or relative to the postion of the
                parent compartment.  The -syndens and -syncond options
                specify whether synaptic conductances are expressed as
                densities (conductance per unit area) or in absolute units.
                The format of the cell parameter file is described in the
                documentation for readcell.  The routine is capable of
                parsing GENESIS neurons which are not in the 'flat' element
                structure produced by the readcell routine.  There are
                limitations to the present version of writecell, as there
                have been new features added to readcell which have not yet
                been incorporated into writecell.  Thus, not all cell models
                can be parameterized with writecell.
See also: readcell

24.161 writefile

Routine Name:   writefile

Description:    Writes out ASCII data to currently opened file.

Usage:          writefile filename [arguments ...] [-nonewline] [-format str] 

                filename        name of file to write to (must first be opened
                                with openfile routine with w or a switch)

                -nonewline      do not append carriage return at end of line
                                (if omitted, carriage return is appended)

                -format str     use specified format string str to format each
                                argument (to construct mixed formats, use
                                multiple writefile calls with -n option to
                                place them on a single line)

                arguments       strings to be written out to file (default is
                                nothing, which effectively means a blank line
                                unless -n is selected to suppress carriage
                                return; the arguments are written out with
                                single spaces between each and are terminated
                                with a carriage return)

Example:        openfile test2 w
                // both of these write three entries per line,
                // each separated by a space
                writefile test2 1.0 2.0 3.0
                writefile test2 "4.0 5.0 6.0"

                genesis >  openfile test w
                genesis >  writefile test Vm = 10 "string   with space" {10+5}
                genesis >  writefile test  one -n
                genesis >  writefile test line
                genesis >  writefile test X Y -format "%5s"
                genesis >  writefile test 5.3 6.5 -format "(%3s)"
                genesis >  writefile test FIRST SECOND -n -format "%-10s"
                genesis >  writefile test  THIRD -format "%30s"
                genesis >  writefile test done
                genesis >  closefile test
                genesis >  more test
                Vm = 10 string   with space 15
                oneline
                    X    Y
                (5.3)(6.5)
                FIRST     SECOND                         THIRD
                done            
                genesis >

Notes:          The changes you make are made permanent when you close the
                file (using closefile), or flush the buffer with flushfile.

                There is limited formatting of output.
See also: openfile , closefile , listfiles , readfile , flushfile , floatformat

24.162 xcolorscale

Routine Name:   xcolorscale

Description:    Sets the color scale for mapping numerical values to
                color.

Usage:          xcolorscale colorscale
                colorscale:     hot, rainbow, rainbow2, redhot, or grey

Example:        xcolorscale hot

Notes:          The colorscale (which is a file in genesis/startup) applies
                to pixes which have a field mapped to color, such as the
                shapes in an xvar or xview, or the cell display in xcell.  It
                does not apply to widgets, like buttons, labels, etc.

24.163 xgetstat

Routine Name:           xgetstat

Description:            returns 0 if Xodus is not properly initialized.

Usage:                  status = {xgetstat}

Example:                echo {xgetstat}
                        1

                        if ({{xgetstat})
                                include graphics
                        end

Notes:                  It is possible to run GENESIS without XODUS by using
                        the -nox option to the genesis command line.  If a
                        simulation is to intended to be run both with and
                        without XODUS, a simulation script may use xgetstat to
                        determine if XODUS is available.
See also: genesis


Previous Next Table of Contents