# System Calls¶↑

## Path Manipulation¶↑

chdir()
Syntax:
h.chdir("path")
Description:
Change working directory to the indicated path. Returns 0 if successful otherwise -1, ie the usual unix os shell return style.

getcwd()
Syntax:
h.getcwd()
Description:
Returns absolute path of current working directory in unix format. The last character of the path name is ‘/’. Must be less than 1000 characters long.

neuronhome()
Name:
neuronhome – installation path
Syntax:
h.neuronhome()
Description:

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.

## Machine Identification¶↑

machine_name()
Syntax:

h("strdef name")

h.machine_name(h.name)

Description:
returns the hostname of the machine.

unix_mac_pc()
Syntax:
h.unix_mac_pc()
Description:
Return 1 if unix, 2 if mac, 3 if mswin, or 4 if mac osx darwin is the operating system. This is useful when deciding if a machine specific function can be called or a dll can be loaded.
Example:
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"


nrnversion()
Syntax:

h.nrnversion()

h.nrnversion(i)

Description:

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


## Timing¶↑

startsw()
Syntax:

h.startsw()

Initializes a stopwatch with a resolution of 1 second or 0.01 second if gettimeofday system call is available. See stopsw() .

stopsw()
Syntax:

h.stopsw()

Returns the time in seconds since the stopwatch was last initialized with a startsw() .

Description:

Really the idiom

x = h.startsw()
h.startsw() - x


should be used since it allows nested timing intervals.

Example:
from neuron import h, gui
from math import *
h.startsw()
for i in range(100000):
x = sin(0.2)
print h.stopsw()


## Miscellaneous¶↑

nrn_load_dll()
Syntax:
h.nrn_load_dll(dll_file_name)
Description:
Loads a dll containing membrane mechanisms. This works for mswin, mac, and linux.
show_winio()
Syntax:
h.show_winio(0or1)
Description:
MSWin and Mac version only. Hides or shows the console window.