Returns the full installation path in unix format or, if it exists, the NEUROHOME environment variable in unix format.
Note that for unix, it isn't exactly the installation path but the --prefix/share/nrn directory where --prefix is the location specified during installation. For the mswin version it is the location selected during installation and the value is derived from the location of neuron.exe in neuronhome()/bin/neuron.exe. For mac it is the folder that contains the neuron executable program.
h("strdef name")
h.machine_name(h.name)
from neuron import h, gui
type = h.unix_mac_pc()
if type == 1:
print "This os is unix based"
elif type == 2:
print "This os is mac based"
elif type == 3:
print "This os is mswin based"
elif type == 4:
print "This os is mac osx darwin based"
h.nrnversion()
h.nrnversion(i)
Returns a string consisting of version information. When this function was introduced the majorstring was "5.6" and the branch string was "2004/01/22 Main (36)". Now the arg can range from 0 to 6. The value of 6 returns the args passed to configure. When this function was last changed the return values were.
An arg of 7 now returns a space separated string of the arguments used during launch. e.g.
$ nrniv -nobanner -c 'nrnversion()' -c 'nrnversion(7)'
NEURON -- VERSION 7.2 twophase_multisend (534:2160ccb31406) 2010-12-09
nrniv -nobanner -c nrnversion() -c nrnversion(7)
$
An arg of 8 now returns the host-triplet. E.g.
$ nrniv -nobanner -c 'nrnversion(8)'
x86_64-unknown-linux-gnu
An arg of 9 now returns "1" if the neuron main program was launched, "2" if the library was loaded by Python, and "0" if the launch progam is unknown
$ nrniv -nobanner -c 'nrnversion(9)'
1
$ python 2</dev/null
>>> from neuron import h
>>> h.nrnversion(9)
'2'
from neuron import h, gui
h.nrnversion()
NEURON -- VERSION 7.1 (296:ff4976021aae) 2009-02-27
for i in range(6):
print i,": ", h.nrnversion(i)
0 : 7.5
1 : NEURON -- VERSION 7.5 (1482:5fb6a5cbbdb7) 2016-11-25
2 : VERSION 7.5 (1482:5fb6a5cbbdb7)
3 : 5fb6a5cbbdb7
4 : 2016-11-25
5 : 1482
6 : '--with-iv=/usr/site/nrniv/iv' '--prefix=/usr/site/../arch/nrn' '--with-nrnpython' '--with-paranrn'
exitcode = h.system(cmdstr)
exitcode = h.system(cmdstr, stdout_str)
Example:
- h.system("ls")
- Prints a directory listing in the console terminal window. will take up where it left off when the user types the exit command
Warning
Fully functional on unix, mswin under cygwin, and mac osx.
Does not work on the mac os 9 version.
Following is obsolete: Under mswin, executes the string under the cygwin sh.exe in $NEURONHOME/bin via the wrapper, $NEURONHOME/lib/nrnsys.sh. Normally, stdout is directed to the file tmpdos2.tmp in the working directory and this is copied to the terminal. The neuron.exe busy waits until the nrnsys.sh script creates a tmpdos1.tmp file signaling that the system command has completed. Redirection of stdout to a file can only be done with the idiom "command > filename". No other redirection is possible except by modifying nrnsys.sh.
h.startsw()
Initializes a stopwatch with a resolution of 1 second or 0.01 second if gettimeofday system call is available. See stopsw() .
h.stopsw()
Returns the time in seconds since the stopwatch was last initialized with a startsw() .
Really the idiom
x = h.startsw()
h.startsw() - x
should be used since it allows nested timing intervals.
from neuron import h, gui
from math import *
h.startsw()
for i in range(100000):
x = sin(0.2)
print h.stopsw()
See also