Skip to content

Commit e28ff0a

Browse files
authored
Merge pull request #107 from PKU-NIP-Lab/V2.1.1
fix #98: add the inputs tutorial to toolbox
2 parents 12b7886 + 950f537 commit e28ff0a

File tree

8 files changed

+559
-473
lines changed

8 files changed

+559
-473
lines changed

brainpy/dyn/neurons/reduced_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ def __init__(self, size, V_rest=-70., V_reset=-70., V_th_inf=-50., V_th_reset=-6
714714
self.I1 = bm.Variable(bm.zeros(self.num))
715715
self.I2 = bm.Variable(bm.zeros(self.num))
716716
self.V_th = bm.Variable(bm.ones(self.num) * -50.)
717-
self.V = bm.Variable(bm.zeros(self.num))
717+
self.V = bm.Variable(bm.zeros(self.num) - 70.)
718718
self.input = bm.Variable(bm.zeros(self.num))
719719
self.spike = bm.Variable(bm.zeros(self.num, dtype=bool))
720720
self.t_last_spike = bm.Variable(bm.ones(self.num) * -1e7)

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ The code of BrainPy is open-sourced at GitHub:
6464
tutorial_toolbox/synaptic_weights
6565
tutorial_toolbox/optimizers
6666
tutorial_toolbox/runners
67+
tutorial_toolbox/inputs
6768
tutorial_toolbox/monitors
6869
tutorial_toolbox/saving_and_loading
6970

docs/quickstart/simulation.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"id": "43ec39f4",
171171
"metadata": {},
172172
"source": [
173-
"After build a SNN, we can use it for dynamic simulation. To run a simulation, we need first wrap the network model into a runner. Currently BrainPy provides ``DSRunner``, ``StructRunner``, ``ReportRunner`` in ``brainpy.dyn``. They receive inputs with the same structure, and will be expanded in [Running a Simulation](../tutorial_simulation/runner.ipynb). Here we use ``DSRunner`` as an example:"
173+
"After build a SNN, we can use it for dynamic simulation. To run a simulation, we need first wrap the network model into a **runner**. Currently BrainPy provides ``DSRunner`` and ``ReportRunner`` in ``brainpy.dyn``, which will be expanded in the [Runners](../tutorial_simulation/runner.ipynb) tutorial. Here we use ``DSRunner`` as an example:"
174174
]
175175
},
176176
{
@@ -191,7 +191,7 @@
191191
"id": "11473917",
192192
"metadata": {},
193193
"source": [
194-
"To make dynamic simulation more applicable and powerful, users can [**monitor**](../tutorial_simulation/monitors_and_inputs.ipynb) variable trajectories and give [**inputs**](../tutorial_simulation/monitors_and_inputs.ipynb) to target neuron groups. Here we monitor the ``spike`` variable in the ``E`` and ``I`` LIF model, which refers to the spking status of the neuron group, and give a constant input to both neuron groups. The time interval of numerical integration ``dt`` (with the default value of 0.1) can also be specified.\n",
194+
"To make dynamic simulation more applicable and powerful, users can [**monitor**](../tutorial_toolbox/monitors.ipynb) variable trajectories and give [**inputs**](../tutorial_toolbox/inputs.ipynb) to target neuron groups. Here we monitor the ``spike`` variable in the ``E`` and ``I`` LIF model, which refers to the spking status of the neuron group, and give a constant input to both neuron groups. The time interval of numerical integration ``dt`` (with the default value of 0.1) can also be specified.\n",
195195
"\n",
196196
"After creating the runner, we can run a simulation by calling the runner:"
197197
]
@@ -290,9 +290,9 @@
290290
],
291291
"metadata": {
292292
"kernelspec": {
293-
"display_name": "brainpy",
293+
"display_name": "Python [conda env:root] *",
294294
"language": "python",
295-
"name": "brainpy"
295+
"name": "conda-root-py"
296296
},
297297
"language_info": {
298298
"codemirror_mode": {
@@ -304,7 +304,7 @@
304304
"name": "python",
305305
"nbconvert_exporter": "python",
306306
"pygments_lexer": "ipython3",
307-
"version": "3.8.11"
307+
"version": "3.8.8"
308308
},
309309
"latex_envs": {
310310
"LaTeX_envs_menu_present": true,

docs/tutorial_simulation/network_models.ipynb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
"id": "84449872",
343343
"metadata": {},
344344
"source": [
345-
" All elements are passed as ``**kwargs`` argument can be accessed by the provided keys. This will affect the following dynamics simualtion and will be discussed in greater detail in [tutorial of Monitors and Inputs](../tutorial_simulation/monitors_and_inputs.ipynb)."
345+
"All elements are passed as ``**kwargs`` argument can be accessed by the provided keys. This will affect the following dynamics simualtion and will be discussed in greater detail in tutorial of [Runners](../tutorial_toolbox/runners.ipynb)."
346346
]
347347
},
348348
{
@@ -466,13 +466,21 @@
466466
"id": "ee0ef0f9",
467467
"metadata": {},
468468
"source": [
469-
"Above are some simulation examples showing the possible application of network models. The detailed description of dynamics simulation is covered in [Dynamics Simulation](../tutorial_simulation/index.rst), where the use of monitors and inputs will be expatiated."
469+
"Above are some simulation examples showing the possible application of network models. The detailed description of dynamics simulation is covered in the toolboxes, where the use of [runners](../tutorial_toolbox/runners.ipynb), [monitors](../tutorial_toolbox/monitors.ipynb), and [inputs](../tutorial_toolbox/inputs.ipynb) will be expatiated."
470470
]
471+
},
472+
{
473+
"cell_type": "code",
474+
"execution_count": null,
475+
"id": "d31c4afc",
476+
"metadata": {},
477+
"outputs": [],
478+
"source": []
471479
}
472480
],
473481
"metadata": {
474482
"kernelspec": {
475-
"display_name": "Python 3 (ipykernel)",
483+
"display_name": "Python 3",
476484
"language": "python",
477485
"name": "python3"
478486
},
@@ -486,7 +494,7 @@
486494
"name": "python",
487495
"nbconvert_exporter": "python",
488496
"pygments_lexer": "ipython3",
489-
"version": "3.9.7"
497+
"version": "3.8.8"
490498
},
491499
"latex_envs": {
492500
"LaTeX_envs_menu_present": true,

docs/tutorial_simulation/neuron_models.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@
395395
"id": "f9d2604b",
396396
"metadata": {},
397397
"source": [
398-
"The details of the model simulation will be expanded in the [Dynamics Simulation](../tutorial_simulation/index.rst) section. In brief, running any dynamical system instance should be accomplished with a runner, such like `brianpy.StructRunner` and `brainpy.ReportRunner`. In the runner, the variables want to monitor and the input crrents try to specify can be provided when initializing the runner. The details please see the tutorial of [Monitors and Inputs](../tutorial_simulation/monitors_and_inputs.ipynb). "
398+
"The details of the model simulation will be expanded in the [Runners](../tutorial_toolbox/runners.ipynb) section. In brief, running any dynamical system instance should be accomplished with a runner, such like `brianpy.DSRunner` and `brainpy.ReportRunner`. The variables to be monitored and the input crrents to be applied in the simulation can be provided when initializing the runner. The details are accessible in [Monitors](../tutorial_toolbox/monitors.ipynb) and [Inputs](../tutorial_toolbox/inputs.ipynb). "
399399
]
400400
},
401401
{
@@ -512,7 +512,7 @@
512512
],
513513
"metadata": {
514514
"kernelspec": {
515-
"display_name": "Python 3 (ipykernel)",
515+
"display_name": "Python 3",
516516
"language": "python",
517517
"name": "python3"
518518
},
@@ -526,7 +526,7 @@
526526
"name": "python",
527527
"nbconvert_exporter": "python",
528528
"pygments_lexer": "ipython3",
529-
"version": "3.9.7"
529+
"version": "3.8.8"
530530
},
531531
"latex_envs": {
532532
"LaTeX_envs_menu_present": true,
@@ -562,4 +562,4 @@
562562
},
563563
"nbformat": 4,
564564
"nbformat_minor": 5
565-
}
565+
}

docs/tutorial_simulation/synapse_models.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
"1. Constructor function ``__init__()``, in which three key arguments are needed. \n",
170170
" - `pre`: the pre-synaptic neural group. It should be an instance of `brainpy.dyn.NeuGroup`.\n",
171171
" - `post`: the post-synaptic neural group. It should be an instance of `brainpy.dyn.NeuGroup`.\n",
172-
" - `conn` (optional): the connection type between these two groups. BrainPy has provided abundant connection types that are described in details in the [Synaptic Connections](./synaptic_connections.ipynb).\n",
172+
" - `conn` (optional): the connection type between these two groups. BrainPy has provided abundant connection types that are described in details in the [Synaptic Connections](../tutorial_toolbox/synaptic_connections.ipynb).\n",
173173
"2. Update function ``update(_t, _dt)`` describes the updating rule from the current time $\\mathrm{\\_t}$ to the next time $\\mathrm{\\_t + \\_dt}$. "
174174
]
175175
},
@@ -385,7 +385,7 @@
385385
"id": "44fa4941",
386386
"metadata": {},
387387
"source": [
388-
"More details of the connection structures please see the tutorial of [Synaptic Connections](./synaptic_connections.ipynb)."
388+
"More details of the connection structures please see the tutorial of [Synaptic Connections](../tutorial_toolbox/synaptic_connections.ipynb)."
389389
]
390390
},
391391
{
@@ -953,15 +953,15 @@
953953
"\n",
954954
"Imaging you want to connect 10,000 pre-synaptic neurons to 10,000 post-synaptic neurons with a 10% random connection probability. Using matrix, you need $10^8$ floats to save the synaptic state, and at each update step, you need do computation on $10^8$ floats. Actually, the number of synapses you really connect is only $10^7$. See, there is a huge memory waste and computing resource inefficiency. Moreover, at the given time $\\mathrm{\\_t}$, the number of pre-synaptic neurons in the spiking state is small on average. This means we have made many useless computations when defining synaptic computations with matrix-based connections (zeros dot connection matrix results in zeros).\n",
955955
"\n",
956-
"Therefore, we need new ways to define synapse models. Specifically, we use vectors to store the connected neuron indices, like the ``pre_ids`` and ``post_ids`` (see [Synaptic Connections](./synaptic_connections.ipynb)). "
956+
"Therefore, we need new ways to define synapse models. Specifically, we use vectors to store the connected neuron indices, like the ``pre_ids`` and ``post_ids`` (see [Synaptic Connections](../tutorial_toolbox/synaptic_connections.ipynb)). "
957957
]
958958
},
959959
{
960960
"cell_type": "markdown",
961961
"id": "b67256b8",
962962
"metadata": {},
963963
"source": [
964-
"In the below, we assume you have learned the synaptic connection types detailed in the tutorial of [Synaptic Connections](./synaptic_connections.ipynb)."
964+
"In the below, we assume you have learned the synaptic connection types detailed in the tutorial of [Synaptic Connections](../tutorial_toolbox/synaptic_connections.ipynb)."
965965
]
966966
},
967967
{
@@ -1233,7 +1233,7 @@
12331233
"encoding": "# -*- coding: utf-8 -*-"
12341234
},
12351235
"kernelspec": {
1236-
"display_name": "Python 3 (ipykernel)",
1236+
"display_name": "Python 3",
12371237
"language": "python",
12381238
"name": "python3"
12391239
},
@@ -1247,7 +1247,7 @@
12471247
"name": "python",
12481248
"nbconvert_exporter": "python",
12491249
"pygments_lexer": "ipython3",
1250-
"version": "3.9.7"
1250+
"version": "3.8.8"
12511251
},
12521252
"latex_envs": {
12531253
"LaTeX_envs_menu_present": true,

0 commit comments

Comments
 (0)