Skip to content

Commit f87b4bb

Browse files
committed
update quickstart docs
1 parent 1a3d8c5 commit f87b4bb

File tree

11 files changed

+1933
-1622
lines changed

11 files changed

+1933
-1622
lines changed

docs/auto_generater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def generate_datasets_docs(path='apis/auto/datasets/'):
257257
header='Chaotic Systems')
258258
write_module(module_name='brainpy.datasets.vision',
259259
filename=os.path.join(path, 'vision.rst'),
260-
header='Chaotic Systems')
260+
header='Vision Datasets')
261261

262262

263263
def generate_dyn_docs(path='apis/auto/dyn/'):

docs/index.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ The code of BrainPy is open-sourced at GitHub:
3838

3939
quickstart/installation
4040
quickstart/simulation
41-
quickstart/rate_model
4241
quickstart/training
4342
quickstart/analysis
4443

@@ -66,9 +65,6 @@ The code of BrainPy is open-sourced at GitHub:
6665
tutorial_toolbox/synaptic_connections
6766
tutorial_toolbox/synaptic_weights
6867
tutorial_toolbox/optimizers
69-
tutorial_toolbox/runners
70-
tutorial_toolbox/inputs
71-
tutorial_toolbox/monitors
7268
tutorial_toolbox/saving_and_loading
7369

7470

docs/quickstart/analysis.ipynb

Lines changed: 381 additions & 39 deletions
Large diffs are not rendered by default.

docs/quickstart/installation.rst

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ of BrainPy, you can use:
3535
pip install --pre brainpy
3636
3737
38+
To install ``brainpylib`` (needed in dedicated operators), you can use:
39+
40+
.. code-block:: bash
41+
42+
pip install brainpylib
43+
44+
45+
3846
Installation from source
3947
------------------------
4048

@@ -157,13 +165,7 @@ packages:
157165
158166
conda install numba
159167
160-
- brainpylib: needed in dedicated operators
161-
162-
.. code-block:: bash
163168
164-
pip install brainpylib
165-
166-
167169
- `matplotlib`_: required in some visualization functions, but now it is recommended that users explicitly import matplotlib for visualization
168170

169171
.. code-block:: bash
@@ -174,15 +176,6 @@ packages:
174176
175177
conda install matplotlib
176178
177-
- `NetworkX`_: needed in the visualization of network training
178-
179-
.. code-block:: bash
180-
181-
pip install networkx
182-
183-
# or
184-
185-
conda install networkx
186179
187180
.. _NumPy: https://numpy.org/
188181
.. _Matplotlib: https://matplotlib.org/
@@ -194,4 +187,3 @@ packages:
194187
.. _Numba: https://numba.pydata.org/
195188
.. _CUDA: https://developer.nvidia.com/cuda-downloads
196189
.. _CuDNN: https://developer.nvidia.com/CUDNN
197-
.. _NetworkX: https://networkx.org/

docs/quickstart/rate_model.ipynb

Lines changed: 0 additions & 831 deletions
This file was deleted.

docs/quickstart/simulation.ipynb

Lines changed: 834 additions & 88 deletions
Large diffs are not rendered by default.

docs/quickstart/training.ipynb

Lines changed: 587 additions & 614 deletions
Large diffs are not rendered by default.

docs/tutorial_toolbox/runners.ipynb

Lines changed: 119 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@
33
{
44
"cell_type": "markdown",
55
"id": "9f5ef59c",
6-
"metadata": {},
6+
"metadata": {
7+
"pycharm": {
8+
"name": "#%% md\n"
9+
}
10+
},
711
"source": [
812
"# Runners"
913
]
1014
},
1115
{
1216
"cell_type": "markdown",
1317
"id": "95e252ca",
14-
"metadata": {},
18+
"metadata": {
19+
"pycharm": {
20+
"name": "#%% md\n"
21+
}
22+
},
1523
"source": [
1624
"@[Chaoming Wang](https://github.com/chaoming0625)\n",
1725
"@[Xiaoyu Chen](mailto:[email protected])"
@@ -20,15 +28,23 @@
2028
{
2129
"cell_type": "markdown",
2230
"id": "4a593794",
23-
"metadata": {},
31+
"metadata": {
32+
"pycharm": {
33+
"name": "#%% md\n"
34+
}
35+
},
2436
"source": [
2537
"## Runners for Dynamical Systems"
2638
]
2739
},
2840
{
2941
"cell_type": "markdown",
3042
"id": "ff45c9c2",
31-
"metadata": {},
43+
"metadata": {
44+
"pycharm": {
45+
"name": "#%% md\n"
46+
}
47+
},
3248
"source": [
3349
"The convenient simulation interfaces for dynamical systems in BrainPy are implemented in ``brainpy.simulation.runner``. Currently, we implement two kinds of runner: ``DSRunner`` and ``ReportRunner``. They have their respective advantages. "
3450
]
@@ -37,7 +53,11 @@
3753
"cell_type": "code",
3854
"execution_count": 41,
3955
"id": "c79f1bb6",
40-
"metadata": {},
56+
"metadata": {
57+
"pycharm": {
58+
"name": "#%%\n"
59+
}
60+
},
4161
"outputs": [],
4262
"source": [
4363
"import brainpy as bp\n",
@@ -49,15 +69,23 @@
4969
{
5070
"cell_type": "markdown",
5171
"id": "8addcec8",
52-
"metadata": {},
72+
"metadata": {
73+
"pycharm": {
74+
"name": "#%% md\n"
75+
}
76+
},
5377
"source": [
5478
"## Initializing a runner"
5579
]
5680
},
5781
{
5882
"cell_type": "markdown",
5983
"id": "a9e04882",
60-
"metadata": {},
84+
"metadata": {
85+
"pycharm": {
86+
"name": "#%% md\n"
87+
}
88+
},
6189
"source": [
6290
"Generally, we can initialize a runner with the format of:\n",
6391
"\n",
@@ -73,7 +101,11 @@
73101
{
74102
"cell_type": "markdown",
75103
"id": "1a4205d5",
76-
"metadata": {},
104+
"metadata": {
105+
"pycharm": {
106+
"name": "#%% md\n"
107+
}
108+
},
77109
"source": [
78110
"In which\n",
79111
"- ``target`` specifies the model to be simulated. It must an instance of [brainpy.DynamicalSystem](../apis/auto/simulation/generated/brainpy.simulation.brainobjects.DynamicalSystem.rst). \n",
@@ -86,7 +118,11 @@
86118
{
87119
"cell_type": "markdown",
88120
"id": "94806315",
89-
"metadata": {},
121+
"metadata": {
122+
"pycharm": {
123+
"name": "#%% md\n"
124+
}
125+
},
90126
"source": [
91127
"Here we define an E/I balanced network as the simulation model. "
92128
]
@@ -95,7 +131,11 @@
95131
"cell_type": "code",
96132
"execution_count": 42,
97133
"id": "06017318",
98-
"metadata": {},
134+
"metadata": {
135+
"pycharm": {
136+
"name": "#%%\n"
137+
}
138+
},
99139
"outputs": [],
100140
"source": [
101141
"class EINet(bp.Network):\n",
@@ -123,23 +163,35 @@
123163
{
124164
"cell_type": "markdown",
125165
"id": "f00418dd",
126-
"metadata": {},
166+
"metadata": {
167+
"pycharm": {
168+
"name": "#%% md\n"
169+
}
170+
},
127171
"source": [
128172
"Then we will wrap it in different runners for dynamic simulation."
129173
]
130174
},
131175
{
132176
"cell_type": "markdown",
133177
"id": "1cbdeac2",
134-
"metadata": {},
178+
"metadata": {
179+
"pycharm": {
180+
"name": "#%% md\n"
181+
}
182+
},
135183
"source": [
136184
"## ``brainpy.DSRunner``"
137185
]
138186
},
139187
{
140188
"cell_type": "markdown",
141189
"id": "23e41c2d",
142-
"metadata": {},
190+
"metadata": {
191+
"pycharm": {
192+
"name": "#%% md\n"
193+
}
194+
},
143195
"source": [
144196
"``brainpy.DSRunner`` aims to provide model simulation with an outstanding performance. It takes advantage of the [structural loop primitive](../tutorial_math/control_flows.ipynb) to lower the model onto the XLA devices. "
145197
]
@@ -148,7 +200,11 @@
148200
"cell_type": "code",
149201
"execution_count": 3,
150202
"id": "e0d0127e",
151-
"metadata": {},
203+
"metadata": {
204+
"pycharm": {
205+
"name": "#%%\n"
206+
}
207+
},
152208
"outputs": [
153209
{
154210
"data": {
@@ -190,7 +246,10 @@
190246
"execution_count": 4,
191247
"id": "7190e822",
192248
"metadata": {
193-
"scrolled": false
249+
"scrolled": false,
250+
"pycharm": {
251+
"name": "#%%\n"
252+
}
194253
},
195254
"outputs": [
196255
{
@@ -213,31 +272,47 @@
213272
{
214273
"cell_type": "markdown",
215274
"id": "b8b45777",
216-
"metadata": {},
275+
"metadata": {
276+
"pycharm": {
277+
"name": "#%% md\n"
278+
}
279+
},
217280
"source": [
218281
"Note that if the parameter ``jit`` is set to ``True``, then all the variables will be JIT compiled and thus the system cannot be debugged by Python debugging tools. For debugging, users can set ``jit=False``."
219282
]
220283
},
221284
{
222285
"cell_type": "markdown",
223286
"id": "3d9e82a9",
224-
"metadata": {},
287+
"metadata": {
288+
"pycharm": {
289+
"name": "#%% md\n"
290+
}
291+
},
225292
"source": [
226293
"## ``brainpy.ReportRunner``"
227294
]
228295
},
229296
{
230297
"cell_type": "markdown",
231298
"id": "eaab18b7",
232-
"metadata": {},
299+
"metadata": {
300+
"pycharm": {
301+
"name": "#%% md\n"
302+
}
303+
},
233304
"source": [
234305
"``brainpy.ReportRunner`` aims to provide a Pythonic interface for model debugging. Users can use the standard Python debugging tools when simulating the model with ``ReportRunner``."
235306
]
236307
},
237308
{
238309
"cell_type": "markdown",
239310
"id": "cb659ddd",
240-
"metadata": {},
311+
"metadata": {
312+
"pycharm": {
313+
"name": "#%% md\n"
314+
}
315+
},
241316
"source": [
242317
"The drawback of the ``brainpy.ReportRunner`` is that it is relatively slow. It iterates the loop along times during the simulation."
243318
]
@@ -246,7 +321,11 @@
246321
"cell_type": "code",
247322
"execution_count": 4,
248323
"id": "a6c62e4b",
249-
"metadata": {},
324+
"metadata": {
325+
"pycharm": {
326+
"name": "#%%\n"
327+
}
328+
},
250329
"outputs": [
251330
{
252331
"data": {
@@ -286,7 +365,11 @@
286365
{
287366
"cell_type": "markdown",
288367
"id": "d5b1aa9c",
289-
"metadata": {},
368+
"metadata": {
369+
"pycharm": {
370+
"name": "#%% md\n"
371+
}
372+
},
290373
"source": [
291374
"We can see from the output that the time spent for simulation through ``ReportRunner`` is longer than that through ``DSRunner``."
292375
]
@@ -296,7 +379,10 @@
296379
"execution_count": 5,
297380
"id": "d6036bd0",
298381
"metadata": {
299-
"scrolled": true
382+
"scrolled": true,
383+
"pycharm": {
384+
"name": "#%%\n"
385+
}
300386
},
301387
"outputs": [
302388
{
@@ -319,7 +405,11 @@
319405
{
320406
"cell_type": "markdown",
321407
"id": "3551f214",
322-
"metadata": {},
408+
"metadata": {
409+
"pycharm": {
410+
"name": "#%% md\n"
411+
}
412+
},
323413
"source": [
324414
"## Runners for Neural Network Training"
325415
]
@@ -328,7 +418,11 @@
328418
"cell_type": "code",
329419
"execution_count": null,
330420
"id": "26d3e6e1",
331-
"metadata": {},
421+
"metadata": {
422+
"pycharm": {
423+
"name": "#%%\n"
424+
}
425+
},
332426
"outputs": [],
333427
"source": []
334428
}
@@ -385,4 +479,4 @@
385479
},
386480
"nbformat": 4,
387481
"nbformat_minor": 5
388-
}
482+
}

0 commit comments

Comments
 (0)