cwd | Change or query current current filesystem directory |
[<directory>] | directory to change into |
This command allows the querying and changing of current UNIX, Linux or Windows filesystem directory. If cwd is executed without any parameters, it outputs the current directory. But if a <directory> is specified, the current working directory is changed into it. <directory> can be an absolute or relative path. Note that the path must be specified with slashes ('/') also in Windows environments.
Example: Query and change current UNIX filesystem directory:
NDA> cwd /export/home/anssi NDA> cwd nda/demos/opengl NDA> cwd /export/home/anssi/nda/demos/opengl
if | Conditionally execute a command or a script |
{-exist <nameent> | | check, if name entry exists |
-notexist <nameent>} | | check, if name entry does not exist |
{-file <filename> | | check, if O/S file exists |
-create <filename>} | | check, if it is possible to create the named O/S file |
-expr <expression>; | normal conditional expression |
-cmd <cmdline>: | command to be executed, if condition is true |
-cmd2 <cmdline>: | second command, if condition is true |
-else <cmdline>: | command to be executed, if condition is false |
while | Conditionally repeat (a command or) a script |
-expr <expression> ; | normal conditional expression |
-cmd <cmdline>: | command(s) to be repeated, as long as condition is true |
[-loop <loopcmd>:] | command to be executed after each execution of <cmdline> |
These commands, if and while, allow conditional execution of commands or script files. if first checks, whether a name entry exists, or evaluates the specified expression. If the specified condition is true, if executes the chosen command or script.
while first evaluates specified <expression> and, if it is true, executes the specified <cmdline>. Then it also executes <loopcmd> (if specified) and then the expression is re-evaluated (and, if true, script re-run), until the expression becomes false. If the loop is based on the value of some name entry, it's value should be altered within the repeated script or in <loopcmd>.
Example: To draw a bar showing the average of each data field:
# Load boston data, train SOM, calculate stats and create window NDA> load boston.dat NDA> prepro -d boston -dout prep -n NDA> somtr -d prep -sout som -cout cld -l 5 ... NDA> clstat -c cld -d boston -dout stats -avg NDA> mkgrp win -s som NDA> setgdat win -d stats NDA> setgcld win -c cld NDA> layer win -l 3 NDA> show win # Calculate the number of data fields NDA> len -n boston -fout lkm # Run a loop from 0 to lkm - 1 NDA> expr -fout ind -expr 0; NDA> while -expr 'ind' < 'lkm'; -cmd macbar: NDA> draw /win ...
Contents of script macbar:
# # ${boston[${ind}]} evaluates into the name of # {ind}th field of frame # bar win -f stats.${boston[${ind}]}_avg -co ${ind} expr -fout ind -expr 'ind' + 1;
Example: The same can also be achieved with:
# Load boston data, train SOM, calculate stats and create window NDA> load boston.dat NDA> prepro -d boston -dout prep -n NDA> somtr -d prep -sout som -cout cld -l 5 ... NDA> clstat -c cld -d boston -dout stats -avg NDA> mkgrp win -s som NDA> setgdat win -d stats NDA> setgcld win -c cld NDA> layer win -l 3 # Calculate the number of data fields NDA> len -n boston -fout lkm # Run a loop from 0 to lkm - 1 NDA> expr -fout ind -expr 0; NDA> while -expr 'ind' < 'lkm'; -cmd bar win -f \stats.${boston[${ind}]}_avg -co ${ind}\: -loop expr -fout ind -expr 'ind' + 1;: NDA> show win
echo | Set command echoing on/off or write a message |
{-off | | set command echoing off |
-on} | | set command echoing on |
<message> | write a message into the command list |
This command can be used to suspend or re-invoke command echoing before their execution. Echo is on by default. To avoid the display of echo -off, start the command line with `@'. echo can also be used to write messages to the command history list.
Example: Disable command echoing and write your own messages.
Command file:
# # Load boston data, train SOM, calculate stats and create window # @echo -off echo Load Boston data and train a SOM... load boston.dat prepro -d boston -dout prep -n somtr -d prep -sout som -cout cld -l 5 ... clstat -c cld -d boston -dout stats -avg echo Start visualization... mkgrp win -s som setgdat win -d stats setgcld win -c cld layer win -l 3 show win echo Done.
Verbose output while executing:
Load Boston data and train a SOM... Start visualization... Done.
cmdlog | Log command execution history into a text file |
-off | | end logging |
-o <filename> | log commands into <filename> |
This command either starts or ends the logging of commands. -o specifies a file name and starts logging. -off ends logging.
help | Read the on-line help system |
[<group> | | show help about a group of commands |
<command> | | show help about a single command |
<command>.desc | | show the description of a single command |
<command>.ex ] | show an example of the use of the command |
If help is executed by itself, it lists the available command groups. If a group name is provided, an alphabetical list of the commands in that group is generated. If a command name is provided on command line, the command line switch description(s) of the requested command and probably some closely related commands are listed.
To show the description of a single command .desc needs to be appended to the name of the command. There also exist some examples of the use of the commands. The example can be requested be appending .ex to <command>.
The help system requires, that the NDAHOME environment variable is correctly set to point into a directory containing help.txt.
stop | Do we stop command file execution if we encounter errors? |
-off | | do not stop execution |
-on | stop execution at first encountered error (default) |
This command can be used to make NDA tolerant to insignificant errors while executing command scripts. If stop is set to off, command file execution continues even if errors are encountered.
Without any parameters stop halts the execution of current command file.
Example: Disable stop on errors due to an old-fashioned script that does not perform all the needed verifications.
@echo -off stop -off rm -ref clsel # if should be used to check whether clsel # exists or not select clsel -cl cl1.neuron_$1 ... stop -on
return | Return from a macro |
This command ends the execution of a single macro. It differs from stop command (see section 11.6), because it does not stop the execution of those macros that have invoked the current.
exit | Exit NDAshell |
quit | Exit NDAshell |
These commands end the execution of an interactive NDAshell. They cannot be used in macros. Instead, the stop command (see section 11.6) and -quit command line switch can be used to make NDAshell quit, if something unexpected occurs.
opsys | Find out host operating system type |
-fout <os-val> | name for the field into which the OS name is stored |
This command stores the name of current operating system into a field. Possible return values are Solaris, Linux, Unix and Windows.
!<unix-command> | any UNIX command including possible parameters |
This command starts a process and runs the specified UNIX command in it. NDA waits until the UNIX command has been executed. If an ampersand (&) is written at the end of the command line, the command is executed in the background.
Example: In this simple example a new SOM is created and trained. Then the weight matrix is stored into a disk file and UNIX program textedit invoked to show the values in the stored matrix.
... NDA> load boston.dat NDA> prepro -d boston -dout pre1 -e -n NDA> somtr -d pre1 -sout som1 -l 5 ... NDA> save som1_W NDA> !textedit som1_W.dat ...
randomize | Initialize random number generator using current time |
srand | Initialize the random number generator into a specified value |
<seed-value> | seed value to be used |
These commands initialize the random number generator. randomize provides a pseudo random initial value that differs for each invocation. srand can be used to initialize the random number generator with a known value.
There are five special commands for handling the GUI in the UNIX version of ndashell: show for starting a graphical window, showfz for starting a fuzzy tool, showgl for starting OpenGL, wait for pausing macro execution, and draw for updating the windows from macros. show, showgl and draw are also available in the Windows version of ndashell.
show | Open a graphic view |
<graphic> | name of the graphic structure |
[-t <type>] | type of the view: net | vec | frm |
[-hide] | hide the tool menu |
[-display <dsp>] | the address of the X server |
[-x <x>] | x coordinate for the window (default is 100) |
[-y <y>] | y coordinate for the window (default is 100) |
[-w <width>] | width of the window (default is 500) |
[-h <height>] | height of the window (default is 500) |
[-mac <macro>] | macro name for interactive execution |
[-params <params>;] | parameters for interactive execution |
This command opens a graphic tool to be used for changing the settings and viewing a graphic structure. The second parameter <type> defines what kind of window is opened. If it is omitted the operation chooses window type according to the type of the graphic. The tool menu can be hidden with flag -hide. The location and dimensions of the new window can be specified with parameters <x>, <y>, <width> and <height>. Parameters <macro> and <params> are passed onto the fields in `Program control' menu and the interactive execution is switched on.
showfz | Show a fuzzy structure |
<fuzzyname> | name of the fuzzy structure |
[-f <field>] | field to be fuzzified |
This operation is available only when a graphical user interface (e.g. Xview) is linked to the program. showfz opens the fuzzy tool. If the specified fuzzy structure does not exist, it is created. A field must also be specified to the command. If the structure is found then it will be edited.
Example: In this example a fuzzy structure is created and the fuzzy tool is started.
NDA> mkfz fz1 -f boston.zn 0.00000 100.00000 # mkfz command displays the range of the field # showfz opens a tool to define sets NDA> showfz fz1
showgl | Show a graph using OpenGL |
<graphic> | name of the graphic structure |
[-t <type>] | type of the view: net | vec | frm |
This command opens a graphic tool to be used for viewing a graphic structure in 3D using OpenGL. The second parameter <type> defines what kind of window is opened. If it is omitted the operation chooses window type according to the type of the graphic. The OpenGL user interface is executed in a separate thread and if settings of the graph <graphic> are altered in another window, the OpenGL view is automatically updated to reflect the changes. There can be only one OpenGL window open at a time. If an OpenGL window is already open, executing showgl only changes the contents of the graph.
wait | Pauses the execution of a command file |
This command pauses the execution of a command file and opens a small window, from which the user can either continue or break the execution of the file. While the execution is paused, the normal user interface cannot be used.
draw | Update a graphic window |
[<window-title>] | title of the window |
This command updates a graphical window. When you execute commands from the command line window, they do not immediately affect graphical views. Instead, you have to update them by using draw. Note that you must use the exact path of the graphical structure. Without the title, draw command updates all graphical windows.