diff --git a/doc/htmldoc/connect_nest/nest_server.rst b/doc/htmldoc/connect_nest/nest_server.rst index 45f4782222..87d3212259 100644 --- a/doc/htmldoc/connect_nest/nest_server.rst +++ b/doc/htmldoc/connect_nest/nest_server.rst @@ -79,9 +79,9 @@ consideration, each of the restrictions can be disabled by setting a correspondi * ``NEST_SERVER_DISABLE_AUTH``: By default, the NEST Server requires a NESTServerAuth tokens. Setting this variable to ``1`` disables this restriction. A token is automatically created and printed to the console by NEST Server upon start-up. If needed, a custom token can be set using the environment variable ``NEST_SERVER_ACCESS_TOKEN`` -* ``NEST_SERVER_CORS_ORIGINS``: By default, the NEST Server only allows requests from localhost (see `CORS - `_). Other hosts can be explicitly allowed by supplying them - in the form `http://host_or_ip:*`` to this variable (By default: http://localhost:*). +* ``NEST_SERVER_CORS_ORIGINS``: By default, the NEST Server only allows requests from localhost (see + `CORS `_). Other hosts can be explicitly allowed by supplying them + in the form http://host_or_ip:\* to this variable (By default: http://localhost:\*). * ``NEST_SERVER_ENABLE_EXEC_CALL``: By default, NEST Server only allows calls to its PyNEST-like API. If the use-case requires the execution of scripts via the ``/exec`` route, this variable can be set to ``1``. PLEASE BE AWARE THAT THIS OPENS YOUR COMPUTER TO REMOTE CODE EXECUTION. diff --git a/doc/htmldoc/devices/index.rst b/doc/htmldoc/devices/index.rst index 1176894c5c..4477c36a7c 100644 --- a/doc/htmldoc/devices/index.rst +++ b/doc/htmldoc/devices/index.rst @@ -8,7 +8,7 @@ All about devices in NEST .. grid-item-card:: Stimulate the network :class-title: sd-d-flex-row sd-align-minor-center - :link: stimuate_network + :link: stimulate_network :link-type: ref .. grid-item-card:: Get data from simulation diff --git a/doc/htmldoc/get-started_index.rst b/doc/htmldoc/get-started_index.rst index 2bf2698ac4..277ac2e933 100644 --- a/doc/htmldoc/get-started_index.rst +++ b/doc/htmldoc/get-started_index.rst @@ -232,8 +232,6 @@ More topics .. toctree:: :hidden: - understand_index - .. |nav| image:: static/img/GPS-Settings-256_nest.svg .. |script| image:: static/img/script_white.svg :scale: 20% diff --git a/doc/htmldoc/index.rst b/doc/htmldoc/index.rst index 8071789531..1306ea5ba0 100644 --- a/doc/htmldoc/index.rst +++ b/doc/htmldoc/index.rst @@ -1,29 +1,35 @@ -Welcome to the NEST Simulator documentation -=========================================== - - +Welcome to the NEST Simulator documentation! +============================================ .. grid:: + :gutter: 2 .. grid-item:: - NEST is used in computational neuroscience to model and study behavior of large networks of neurons. + .. grid:: 1 1 1 1 + :gutter: 2 - The models describe single neuron and synapse behavior and their connections. - Different mechanisms of plasticity can be used to investigate artificial learning - and help to shed light on the fundamental principles of how the brain works. + .. grid-item:: + + NEST is used in computational neuroscience to model and study behavior of large networks of neurons. - NEST offers convenient and efficient commands to define and connect large networks, - ranging from algorithmically determined connections to data-driven connectivity. - Create connections between neurons using numerous synapse models from STDP to gap junctions. + The models describe single neuron and synapse behavior and their connections. + Different mechanisms of plasticity can be used to investigate learning + and help to shed light on the fundamental principles of how the brain works. - .. button-ref:: tutorials_guides - :ref-type: ref - :shadow: - :color: primary + NEST offers convenient and efficient commands to define and connect large networks, + ranging from algorithmically determined connections to data-driven connectivity. + Create connections between neurons using numerous synapse models from STDP to gap junctions. - Start exploring NEST + .. grid-item:: + + .. button-ref:: tutorials_guides + :ref-type: ref + :shadow: + :color: primary + + Start exploring NEST .. grid-item:: @@ -47,7 +53,7 @@ Welcome to the NEST Simulator documentation .. figure:: static/img/astrocyte_interaction.png - Investigate neuron and astrocyte interactions + Inspect neuron and astrocyte interactions .. figure:: static/img/hpc_benchmark_connectivity.svg @@ -58,7 +64,7 @@ Welcome to the NEST Simulator documentation .. figure:: static/img/pong_sim.gif - Play PONG with NEST + Simulate a game of PONG with NEST .. figure:: static/img/gapjunctions.png @@ -76,6 +82,36 @@ Welcome to the NEST Simulator documentation Discover all our examples! +How NEST works --- The Big Picture +---------------------------------- + +.. grid:: + + .. grid-item:: + + .. raw:: html + + + + +.. grid:: + + .. grid-item:: + + + A NEST simulation is created with input from :doc:`stimulation devices `, + :doc:`neuron models `, and :doc:`synapse models `, + along with :ref:`connection rules `. + You can choose what data to record with :doc:`recording devices `. + After simulation, the output is ready for analysis with NEST's built in :py:mod:`.raster_plot` and :py:mod:`.voltage_trace` + modules or external tools such as :doc:`Elephant `. + + + You can find these components in NEST or you can implement your own custom + models and extend NEST's functionalities using :doc:`NESTML ` and the :doc:`NEST extension module `, respectively. + Check out our wide-ranging list of :doc:`network model ` examples. + + .. toctree:: :caption: USAGE :hidden: diff --git a/doc/htmldoc/neurons/parametrization.rst b/doc/htmldoc/neurons/parametrization.rst index 19a3c4dc53..93e10df4a6 100644 --- a/doc/htmldoc/neurons/parametrization.rst +++ b/doc/htmldoc/neurons/parametrization.rst @@ -19,6 +19,16 @@ The following parameters and functionalities are provided: - :ref:`Combination of parameters ` +.. admonition:: Create parameters after setting number of threads! + + For correct results, it is essential to create parameter objects + only *after* the number of threads (virtual processes) has been + set. If parameter objects are created first and the number of + threads changed afterwards, this will result incorrect behavior and + possibly a segmentation fault. Unfortunately, NEST cannot currently + detect existing parameter objects when the number of threads change. + + .. _random_ex: Random parameters diff --git a/doc/htmldoc/related_projects.rst b/doc/htmldoc/related_projects.rst index 1bcd309ab5..06b5005e92 100644 --- a/doc/htmldoc/related_projects.rst +++ b/doc/htmldoc/related_projects.rst @@ -90,10 +90,10 @@ real-time operation. TheVirtualBrain (TVB) --------------------- -:ref:`TVB ` is a framework for the simulation of the dynamics of large-scale brain networks with +:ref:`TVB ` is a framework for the simulation of the dynamics of large-scale brain networks with biologically realistic connectivity. -* :ref:`Get started with TVB ` +* :ref:`Get started with TVB ` ConnPlotter ----------- diff --git a/doc/htmldoc/static/css/custom.css b/doc/htmldoc/static/css/custom.css index 8937a43743..befdde6953 100644 --- a/doc/htmldoc/static/css/custom.css +++ b/doc/htmldoc/static/css/custom.css @@ -115,6 +115,20 @@ section#kernel-attributes-nest-nestmodule dd { padding-bottom: 20px !important; box-shadow: 3px 3px var(--nest-orange) !important; } + + +.center { + + text-align: center; + font-style: italic; +} +/* Provide a specific height to the svg object on index page + * Reason: Safari does not interpret percentages or max-content + * correctly + * there is an additional @media setting for <768px screens*/ +section#welcome-to-the-nest-simulator-documentation object { + height: 400px; +} /************************************************************* * Rules for mermaid diagrams *************************************************************/ @@ -141,12 +155,6 @@ figure.align-default { outline-style: groove; } -.center { - - text-align: center; - font-style: italic; -} - /************************************************************************************** * Rules for carousel * ***********************************************************************************/ @@ -212,10 +220,11 @@ div[role="main"] .md-source { border-radius: 5px; } /* Add padding around buttons on index page */ -#welcome-to-the-nest-simulator-documentation [data-md-color-primary="orange"] .md-typeset a { +#welcome-to-the-nest-simulator-documentation [data-md-color-primary="orange"] .sd-button { padding: 6px; } + .md-typeset details { background-color: white; } @@ -347,6 +356,11 @@ nav.md-nav.md-nav--secondary label.md-nav__title:after{ font-weight: bold; display: flex; align-items: center; + +} + +#welcome-to-the-nest-simulator-documentation .sd-row-cols-lg-1 > *{ +width: 85%; } #pynest-examples img.sd-card-img-top { @@ -975,7 +989,11 @@ This is for the larger monitors and possibly full screen viewers. @media only screen and (min-width: 1240px) { #hero h1{ font-size:2em;} } - +@media only screen and (max-width: 768px) { + section#welcome-to-the-nest-simulator-documentation object { + height: 200px; + } +} /* RETINA (2x RESOLUTION DEVICES) This applies to the retina iPhone (4s) and iPad (2,3) along with diff --git a/doc/htmldoc/static/img/excalidraw_nestconcept_horiz.svg b/doc/htmldoc/static/img/excalidraw_nestconcept_horiz.svg new file mode 100644 index 0000000000..c188201eec --- /dev/null +++ b/doc/htmldoc/static/img/excalidraw_nestconcept_horiz.svg @@ -0,0 +1,21 @@ + + + + + + + + Experimental ProtocolsNeuron ModelsNetwork ModelsSynapse ModelsRecording DevicesStimulation DevicesData AnalysisConnection Rules diff --git a/doc/htmldoc/synapses/synapse_specification.rst b/doc/htmldoc/synapses/synapse_specification.rst index f12abd2b95..c42038fbf1 100644 --- a/doc/htmldoc/synapses/synapse_specification.rst +++ b/doc/htmldoc/synapses/synapse_specification.rst @@ -65,7 +65,7 @@ Array parameters Array parameters can be used with the rules ``one_to_one``, ``all_to_all``, ``fixed_total_number``, ``fixed_indegree``, and ``fixed_outdegree``. -For details on connection rules, see :ref:`connectivity_concept`. +For details on connection rules, see :ref:`connectivity_concepts`. The arrays can be specified as NumPy arrays or Python lists. As with the scalar parameters, all parameters have to be specified as arrays of the correct type. diff --git a/models/amat2_psc_exp.h b/models/amat2_psc_exp.h index 0b7e49d99f..f058c10305 100644 --- a/models/amat2_psc_exp.h +++ b/models/amat2_psc_exp.h @@ -128,6 +128,9 @@ The following parameters can be set in the status dictionary: implementation to avoid a degenerate case of the ODE describing the model [1]_. For very similar values, numerics will be unstable. + - Some parameter values given in Table 1 of [4]_ are incorrect. For + correct values, see Table 4 of [5]_. + References ++++++++++ @@ -147,6 +150,10 @@ References for reproducing diverse firing patterns and predicting precise firing times. Frontiers in Computational Neuroscience, 5:42. DOI: https://doi.org/10.3389/fncom.2011.00042 +.. [5] Heiberg T, Kriener B, Tetzlaff T, Einevoll GT, Plesser HE (2018). + Firing-rate model for neurons with a broad repertoire of spiking behaviors. + J Comput Neurosci, 45:103. + DOI: https://doi.org/10.1007/s10827-018-0693-9 Sends +++++ diff --git a/models/hh_cond_beta_gap_traub.h b/models/hh_cond_beta_gap_traub.h index c4dda9b281..2c5104a7f1 100644 --- a/models/hh_cond_beta_gap_traub.h +++ b/models/hh_cond_beta_gap_traub.h @@ -94,7 +94,7 @@ Postsynaptic currents Incoming spike events induce a postsynaptic change of conductance modelled by a beta function as outlined in [4]_ [5]_. The beta function is normalized such that an -event of weight 1.0 results in a peak current of 1 nS at :math:`t = \tau_{rise,xx}` +event of weight 1.0 results in a peak conductance of 1 nS at :math:`t = \tau_{rise,xx}` where xx is `ex` or `in`. Spike Detection diff --git a/models/iaf_cond_alpha.h b/models/iaf_cond_alpha.h index 57a6a52f30..f373f2e764 100644 --- a/models/iaf_cond_alpha.h +++ b/models/iaf_cond_alpha.h @@ -69,7 +69,7 @@ Description ``iaf_cond_alpha`` is an implementation of a spiking neuron using IAF dynamics with conductance-based synapses. Incoming spike events induce a postsynaptic change of conductance modelled by an alpha function. The alpha function -is normalized such that an event of weight 1.0 results in a peak current of 1 nS +is normalized such that an event of weight 1.0 results in a peak conductance of 1 nS at :math:`t = \tau_{syn}`. See also [1]_, [2]_, [3]_. diff --git a/models/iaf_cond_exp_sfa_rr.h b/models/iaf_cond_exp_sfa_rr.h index bd87f92633..2f8881cff0 100644 --- a/models/iaf_cond_exp_sfa_rr.h +++ b/models/iaf_cond_exp_sfa_rr.h @@ -74,7 +74,7 @@ spike-frequency adaptation and relative refractory mechanisms as described in Incoming spike events induce a postsynaptic change of conductance modelled by an exponential function. The exponential function is normalized such that an -event of weight 1.0 results in a peak current of 1 nS. +event of weight 1.0 results in a peak conductance of 1 nS. Outgoing spike events induce a change of the adaptation and relative refractory conductances by ``q_sfa`` and ``q_rr``, respectively. Otherwise these conductances diff --git a/models/iaf_psc_delta.h b/models/iaf_psc_delta.h index 2bc4fadf8a..b27e1ee035 100644 --- a/models/iaf_psc_delta.h +++ b/models/iaf_psc_delta.h @@ -121,6 +121,10 @@ hyperpolarization to biophysically plausible values, set parameter .. note:: + + NEST uses exact integration [1]_, [2]_ to integrate subthreshold membrane + dynamics. + Spikes arriving while the neuron is refractory, are discarded by default. If the property ``refractory_input`` is set to True, such spikes are added to the membrane potential at the end of the diff --git a/nestkernel/recording_backend_ascii.h b/nestkernel/recording_backend_ascii.h index 7ec7d74b62..9b0c93915f 100644 --- a/nestkernel/recording_backend_ascii.h +++ b/nestkernel/recording_backend_ascii.h @@ -46,7 +46,7 @@ each MPI process. This can cause a high load on the file system in large simulations. This backend can become prohibitively inefficient, particularly on machines with distributed filesystems. In case you experience such scaling problems, the :doc:`recording backend for -SIONlib ` may be a possible alternative. +SIONlib ` may be a possible alternative. Filenames of data files are determined according to the following pattern: diff --git a/nestkernel/recording_backend_sionlib.h b/nestkernel/recording_backend_sionlib.h index 40e6ddf183..ea7ea77753 100644 --- a/nestkernel/recording_backend_sionlib.h +++ b/nestkernel/recording_backend_sionlib.h @@ -47,7 +47,7 @@ a binary container file (or to a rather small set of such files). This is especially useful for large-scale simulations running in a distributed way on many MPI processes/OpenMP threads. In such usage scenarios, writing to plain text files (see :doc:`recording backend -for ASCII files `) would cause a large +for ASCII files `) would cause a large overhead because of the huge number of generated files and thus be very inefficient. diff --git a/pynest/examples/EI_clustered_network/README.rst b/pynest/examples/EI_clustered_network/README.rst index 4f7d5a43d7..75d3961457 100644 --- a/pynest/examples/EI_clustered_network/README.rst +++ b/pynest/examples/EI_clustered_network/README.rst @@ -16,24 +16,24 @@ If you use this code, we ask you to cite the paper by Rostami et al. [1]_ and th File structure -------------- -* :doc:`run_simulation.py `: an example script to try out the EI-clustered circuit model -* :doc:`network.py `: the main ``Network`` class with functions to build and simulate the network -* :doc:`helper.py `: helper functions for calculation of synaptic weights and currents and plot function for raster plots -* :doc:`network_params.py `: network and neuron parameters -* :doc:`stimulus_params.py `: parameters for optional external stimulation -* :doc:`sim_params.py `: simulation parameters +* :doc:`run_simulation_EI.py `: an example script to try out the EI-clustered circuit model +* :doc:`network_EI.py `: the main ``Network`` class with functions to build and simulate the network +* :doc:`helper_EI.py `: helper functions for calculation of synaptic weights and currents and plot function for raster plots +* :doc:`network_params_EI.py `: network and neuron parameters +* :doc:`stimulus_params_EI.py `: parameters for optional external stimulation +* :doc:`sim_params_EI.py `: simulation parameters Running the simulation ---------------------- .. code-block:: bash - python run_simulation.py + python run_simulation_EI.py A raster plot of the network activity is saved as ``clustered_ei_raster.png``. The code can be parallelized by using multiple threads during the NEST simulation. -This can be done by setting the parameter ``n_vp`` in the ``run_simulation.py`` script. +This can be done by setting the parameter ``n_vp`` in the ``run_simulation_EI.py`` script. Contributions to this PyNEST model implementation ------------------------------------------------- diff --git a/pynest/examples/EI_clustered_network/helper.py b/pynest/examples/EI_clustered_network/helper_EI.py similarity index 99% rename from pynest/examples/EI_clustered_network/helper.py rename to pynest/examples/EI_clustered_network/helper_EI.py index 902535849e..7ae6447d9c 100644 --- a/pynest/examples/EI_clustered_network/helper.py +++ b/pynest/examples/EI_clustered_network/helper_EI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# helper.py +# helper_EI.py # # This file is part of NEST. # diff --git a/pynest/examples/EI_clustered_network/network.py b/pynest/examples/EI_clustered_network/network_EI.py similarity index 99% rename from pynest/examples/EI_clustered_network/network.py rename to pynest/examples/EI_clustered_network/network_EI.py index 306014db17..aa7a4fe7c1 100644 --- a/pynest/examples/EI_clustered_network/network.py +++ b/pynest/examples/EI_clustered_network/network_EI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# network.py +# network_EI.py # # This file is part of NEST. # @@ -58,8 +58,8 @@ class ClusteredNetwork: def __init__(self, sim_dict, net_dict, stim_dict): """Initialize the ClusteredNetwork object. - Parameters are given and explained in the files network_params.py, - sim_params.py and stimulus_params.py. + Parameters are given and explained in the files network_params_EI.py, + sim_params_EI.py and stimulus_params_EI.py. Parameters ---------- diff --git a/pynest/examples/EI_clustered_network/network_params.py b/pynest/examples/EI_clustered_network/network_params_EI.py similarity index 97% rename from pynest/examples/EI_clustered_network/network_params.py rename to pynest/examples/EI_clustered_network/network_params_EI.py index c40eb9cb48..bf7c69e1e3 100644 --- a/pynest/examples/EI_clustered_network/network_params.py +++ b/pynest/examples/EI_clustered_network/network_params_EI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# network_params.py +# network_params_EI.py # # This file is part of NEST. # @@ -20,7 +20,7 @@ # along with NEST. If not, see . """PyNEST EI-clustered network: Network Parameters ------------------------------------------------- +-------------------------------------------------- A dictionary with parameters defining the network and neuron parameters. diff --git a/pynest/examples/EI_clustered_network/run_simulation.py b/pynest/examples/EI_clustered_network/run_simulation_EI.py similarity index 98% rename from pynest/examples/EI_clustered_network/run_simulation.py rename to pynest/examples/EI_clustered_network/run_simulation_EI.py index ecafa112df..1aaadceed8 100644 --- a/pynest/examples/EI_clustered_network/run_simulation.py +++ b/pynest/examples/EI_clustered_network/run_simulation_EI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# run_simulation.py +# run_simulation_EI.py # # This file is part of NEST. # diff --git a/pynest/examples/EI_clustered_network/sim_params.py b/pynest/examples/EI_clustered_network/sim_params_EI.py similarity index 94% rename from pynest/examples/EI_clustered_network/sim_params.py rename to pynest/examples/EI_clustered_network/sim_params_EI.py index 30ac2cd330..d59d57391b 100644 --- a/pynest/examples/EI_clustered_network/sim_params.py +++ b/pynest/examples/EI_clustered_network/sim_params_EI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# sim_params.py +# sim_params_EI.py # # This file is part of NEST. # @@ -20,7 +20,7 @@ # along with NEST. If not, see . """PyNEST EI-clustered network: Simulation Parameters ------------------------------------------------- +----------------------------------------------------- A dictionary with parameters defining the simulation. diff --git a/pynest/examples/EI_clustered_network/stimulus_params.py b/pynest/examples/EI_clustered_network/stimulus_params_EI.py similarity index 94% rename from pynest/examples/EI_clustered_network/stimulus_params.py rename to pynest/examples/EI_clustered_network/stimulus_params_EI.py index f5110a11e5..687d557aa7 100644 --- a/pynest/examples/EI_clustered_network/stimulus_params.py +++ b/pynest/examples/EI_clustered_network/stimulus_params_EI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# stimulus_params.py +# stimulus_params_EI.py # # This file is part of NEST. # @@ -20,7 +20,7 @@ # along with NEST. If not, see . """ PyNEST EI-clustered network: Stimulus Parameters ------------------------------------------------ +----------------------------------------------------- A dictionary with parameters for an optinal stimulation of clusters. diff --git a/pynest/examples/Potjans_2014/network.py b/pynest/examples/Potjans_2014/network.py index a2c59b9778..0d977a8ed5 100644 --- a/pynest/examples/Potjans_2014/network.py +++ b/pynest/examples/Potjans_2014/network.py @@ -424,11 +424,11 @@ def __connect_neuronal_populations(self): conn_dict_rec = {"rule": "fixed_total_number", "N": self.num_synapses[i][j]} if self.weight_matrix_mean[i][j] < 0: - w_min = np.NINF + w_min = -np.inf w_max = 0.0 else: w_min = 0.0 - w_max = np.Inf + w_max = np.inf syn_dict = { "synapse_model": "static_synapse", @@ -449,7 +449,7 @@ def __connect_neuronal_populations(self): # https://nest-simulator.readthedocs.io/en/latest/nest_behavior # /random_numbers.html#rounding-effects-when-randomizing-delays min=nest.resolution - 0.5 * nest.resolution, - max=np.Inf, + max=np.inf, ), } @@ -498,7 +498,7 @@ def __connect_thalamic_stim_input(self): "weight": nest.math.redraw( nest.random.normal(mean=self.weight_th, std=self.weight_th * self.net_dict["weight_rel_std"]), min=0.0, - max=np.Inf, + max=np.inf, ), "delay": nest.math.redraw( nest.random.normal( @@ -509,7 +509,7 @@ def __connect_thalamic_stim_input(self): # https://nest-simulator.readthedocs.io/en/latest/nest_behavior # /random_numbers.html#rounding-effects-when-randomizing-delays min=nest.resolution - 0.5 * nest.resolution, - max=np.Inf, + max=np.inf, ), } diff --git a/pynest/nest/lib/hl_api_connections.py b/pynest/nest/lib/hl_api_connections.py index a415b71727..d84441f2d1 100644 --- a/pynest/nest/lib/hl_api_connections.py +++ b/pynest/nest/lib/hl_api_connections.py @@ -251,16 +251,13 @@ def Connect(pre, post, conn_spec=None, syn_spec=None, return_synapsecollection=F } if len(reduced_processed_syn_spec) > 0: - syn_param_keys = numpy.array(list(reduced_processed_syn_spec.keys()), dtype=numpy.string_) syn_param_values = numpy.zeros([len(reduced_processed_syn_spec), len(pre)]) - for i, value in enumerate(reduced_processed_syn_spec.values()): syn_param_values[i] = value else: - syn_param_keys = None syn_param_values = None - connect_arrays(pre, post, weights, delays, synapse_model, syn_param_keys, syn_param_values) + connect_arrays(pre, post, weights, delays, synapse_model, reduced_processed_syn_spec.keys(), syn_param_values) return diff --git a/pynest/pynestkernel.pyx b/pynest/pynestkernel.pyx index d41f118af9..1fdf7fa537 100644 --- a/pynest/pynestkernel.pyx +++ b/pynest/pynestkernel.pyx @@ -296,19 +296,14 @@ cdef class NESTEngine: raise TypeError('weights must be a 1-dimensional NumPy array') if delays is not None and not (isinstance(delays, numpy.ndarray) and delays.ndim == 1): raise TypeError('delays must be a 1-dimensional NumPy array') - if syn_param_keys is not None and not ((isinstance(syn_param_keys, numpy.ndarray) and syn_param_keys.ndim == 1) and - numpy.issubdtype(syn_param_keys.dtype, numpy.string_)): - raise TypeError('syn_param_keys must be a 1-dimensional NumPy array of strings') if syn_param_values is not None and not ((isinstance(syn_param_values, numpy.ndarray) and syn_param_values.ndim == 2)): raise TypeError('syn_param_values must be a 2-dimensional NumPy array') - if not len(sources) == len(targets): + if len(sources) != len(targets): raise ValueError('Sources and targets must be arrays of the same length.') - if weights is not None: - if not len(sources) == len(weights): + if weights is not None and len(sources) != len(weights): raise ValueError('weights must be an array of the same length as sources and targets.') - if delays is not None: - if not len(sources) == len(delays): + if delays is not None and len(sources) != len(delays): raise ValueError('delays must be an array of the same length as sources and targets.') if syn_param_values is not None: if not len(syn_param_keys) == syn_param_values.shape[0]: @@ -338,8 +333,8 @@ cdef class NESTEngine: # Storing parameter keys in a vector of strings cdef vector[string] param_keys_ptr if syn_param_keys is not None: - for i, key in enumerate(syn_param_keys): - param_keys_ptr.push_back(key) + for key in syn_param_keys: + param_keys_ptr.push_back(key.encode('utf8')) cdef double[:, ::1] param_values_mv cdef double* param_values_ptr = NULL