You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial_toolbox/synaptic_connections.ipynb
+44-18Lines changed: 44 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -109,10 +109,45 @@
109
109
"- `TwoEndConnector`: It has two input parameters `pre_size` and `post_size`, each representing the size of the pre- and post-synaptic neuron group. It will result in a connection matrix with the shape of (pre_num, post_num).\n",
110
110
"- `OneEndConnector`: It has only one parameter `pre_size` which represent the size of the neuron group. It will result in a connection matrix with the shape of (pre_num, pre_num).\n",
111
111
"\n",
112
-
"The `__call__` function returns the class itself.\n",
112
+
"The `__call__` function returns the class itself."
113
+
]
114
+
},
115
+
{
116
+
"cell_type": "markdown",
117
+
"source": [
118
+
"### Connector.build_conn()\n",
119
+
"Users can customize the connection in `build_conn()` function. Notice there are three connection types users can provide:\n",
120
+
"| Connection Types | Definition |\n",
121
+
"| :- | :- |\n",
122
+
"| 'mat' | Dense conncetion, including a connection matrix. |\n",
123
+
"| 'ij' | Index projection, including a pre-neuron index vector and a post-neuron index vector. |\n",
124
+
"| 'csr' | Sparse connection, including a index vector and a indptr vector. |\n",
125
+
"\n",
126
+
"Return type can be either a `dict` or a `tuple`. Here are two examples of how to return your connection data:\n",
"After creating the synaptic connection, users can use the `require()` method to access some useful properties of the connection."
115
-
]
147
+
],
148
+
"metadata": {
149
+
"collapsed": false
150
+
}
116
151
},
117
152
{
118
153
"cell_type": "markdown",
@@ -2006,7 +2041,7 @@
2006
2041
"\n",
2007
2042
"- Your connection class should inherit from `brainpy.connect.TwoEndConnector` or `brainpy.connect.OneEndConnector`.\n",
2008
2043
"- `__init__` function should be implemented and essential parameters should be initialized.\n",
2009
-
"- Users should also overwrite `require()` function to describe how to build your connection. Remember in `require()` users have to call two built-in functions: `self.check(structures)` and `self.make_returns(structures, [csr, mat, ij])`.\n",
2044
+
"- Users should also overwrite `build_conn()` function to describe how to build your connection.\n",
2010
2045
"\n",
2011
2046
"Let's take an example to illustrate the details of customization."
2012
2047
]
@@ -2038,20 +2073,17 @@
2038
2073
" self.seed = seed\n",
2039
2074
" self.rng = np.random.RandomState(seed=seed)\n",
2040
2075
"\n",
2041
-
" def require(self, *structures):\n",
2042
-
" # please call this function for auto-checking inputs.\n",
"Users can customize the connection in `require()` function. And at last user will call `self.make_returns(structures, [csr, mat, ij])` function to automatically produce the structures in parameters. Notice there are also three optional parameters users can provide:\n",
2073
-
"- csr: sparse connection, including a index vector and a indptr vector. \n",
2074
-
"- mat: dense conncetion, including a connection matrix.\n",
2075
-
"- ij: index projection, including a pre-neuron index vector and a post-neuron index vector.\n",
2076
-
"\n",
2077
2103
"Then users can initialize the your own connections as below:"
0 commit comments