def test_libcsa_cgnext(self): """cgnext""" nest.ResetKernel() w = 10000.0 d = 1.0 cs = libcsa.cset(libcsa.oneToOne, w, d) nest.sli_push(cs) nest.sli_run('dup') nest.sli_push(numpy.array([0, 1, 2, 3])) nest.sli_push(numpy.array([0, 1, 2, 3])) nest.sli_run('cgsetmask') nest.sli_run('dup') nest.sli_run('cgstart') for i in range(4): nest.sli_run('dup') nest.sli_run('cgnext') self.assertEqual(nest.sli_pop(), True) self.assertEqual(nest.sli_pop(), d) self.assertEqual(nest.sli_pop(), w) self.assertEqual(nest.sli_pop(), i) self.assertEqual(nest.sli_pop(), i) nest.sli_run('cgnext') self.assertEqual(nest.sli_pop(), False)
def get_help_text(self, name): nest.sli_run("statusdict /prgdocdir get") docdir = nest.sli_pop() helptext = "No documentation available" for subdir in ["cc", "sli"]: filename = os.path.join(docdir, "help", subdir, name + ".hlp") if os.path.isfile(filename): helptext = open(filename, 'r').read() return helptext
def LambertWm1(x): nest.sli_push(x) nest.sli_run('LambertWm1') y = nest.sli_pop() return y
from . import compatibility try: import libcsa HAVE_LIBCSA = True except ImportError: HAVE_LIBCSA = False try: import numpy HAVE_NUMPY = True except ImportError: HAVE_NUMPY = False nest.sli_run("statusdict/have_libneurosim ::") HAVE_LIBNEUROSIM = nest.sli_pop() @nest.check_stack @unittest.skipIf(not HAVE_LIBCSA, 'Python libcsa package is not available') @unittest.skipIf( not HAVE_LIBNEUROSIM, 'PyNEST was built without the libneurosim library' ) class libcsaTestCase(unittest.TestCase): """libcsa tests""" def test_libcsa_OneToOne_subnet_1d(self): """One-to-one connectivity with 1-dim subnets""" nest.ResetKernel()
def LambertWm1(x): nest.sli_push(x); nest.sli_run('LambertWm1'); y=nest.sli_pop() return y
print("Brunel network simulation (Python)") print("Number of neurons : {0}".format(N_neurons)) # including devices and noise print("Number of synapses: {0}".format(num_synapses)) # neurons + noise + spike detectors print( " Exitatory : {0}".format(int(CE * N_neurons) + 2 * N_neurons)) print(" Inhibitory : {0}".format(int(CI * N_neurons))) print("Excitatory rate : %.2f Hz" % rate_ex) print("Inhibitory rate : %.2f Hz" % rate_in) print("Stimulus rate : %.2f Hz" % rate_stim) print("Building time : %.2f s" % build_time) print("Simulation time : %.2f s" % sim_time) nest.sli_run('memory_thisjob') # virtual memory size of NEST process memory = nest.sli_pop() print("Memory : %.2f kB" % memory) ''' A dictionary for population parameters is created to allow for easier access. ''' pops = {} pops['EX'] = {} pops['IN'] = {} pops['STIM'] = {} # neuron numbers pops['EX']['N'] = NE pops['IN']['N'] = NI pops['STIM']['N'] = N_stim
from . import compatibility try: import libcsa HAVE_LIBCSA = True except ImportError: HAVE_LIBCSA = False try: import numpy HAVE_NUMPY = True except ImportError: HAVE_NUMPY = False nest.sli_run("statusdict/have_libneurosim ::") HAVE_LIBNEUROSIM = nest.sli_pop() @nest.check_stack @unittest.skipIf(not HAVE_LIBCSA, 'Python libcsa package is not available') @unittest.skipIf(not HAVE_LIBNEUROSIM, 'PyNEST was built without the libneurosim library') class libcsaTestCase(unittest.TestCase): """libcsa tests""" def test_libcsa_OneToOne_subnet_1d(self): """One-to-one connectivity with 1-dim subnets""" nest.ResetKernel() n = 4 # number of neurons