Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed Jun 18, 2024
1 parent fbde08d commit 9d57224
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 25 deletions.
4 changes: 1 addition & 3 deletions brainpy/_src/math/compat_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

# unique
'array2string', 'asanyarray',
'ascontiguousarray', 'asfarray', 'asscalar', 'common_type', 'disp', 'genfromtxt',
'ascontiguousarray', 'asfarray', 'asscalar', 'common_type', 'genfromtxt',
'loadtxt', 'info', 'issubclass_', 'place', 'polydiv', 'put', 'putmask', 'safe_eval',
'savetxt', 'savez_compressed', 'show_config', 'typename', 'copyto', 'matrix', 'asmatrix', 'mat',

Expand Down Expand Up @@ -725,8 +725,6 @@ def common_type(*arrays):
return array_type[0][precision]


disp = np.disp

genfromtxt = lambda *args, **kwargs: asarray(np.genfromtxt(*args, **kwargs))
loadtxt = lambda *args, **kwargs: asarray(np.loadtxt(*args, **kwargs))

Expand Down
4 changes: 0 additions & 4 deletions brainpy/math/compat_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,12 @@
sort_complex as sort_complex,
unpackbits as unpackbits,
delete as delete,
add_docstring as add_docstring,
add_newdoc as add_newdoc,
add_newdoc_ufunc as add_newdoc_ufunc,
array2string as array2string,
asanyarray as asanyarray,
ascontiguousarray as ascontiguousarray,
asfarray as asfarray,
asscalar as asscalar,
common_type as common_type,
disp as disp,
genfromtxt as genfromtxt,
loadtxt as loadtxt,
info as info,
Expand Down
51 changes: 34 additions & 17 deletions docs/quickstart/analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
],
"source": [
"bp.__version__"
]
],
"id": "b9f06f10049d4a8c"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -108,7 +109,8 @@
"\\tau {\\dot {V}}= - (V - V_\\mathrm{rest}) + \\Delta_T \\exp(\\frac{V - V_T}{\\Delta_T}) + RI \\\\\n",
"\\mathrm{if}\\, \\, V > \\theta, \\quad V \\gets V_\\mathrm{reset}\n",
"$$"
]
],
"id": "1ecf04d3eaf72477"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -355,7 +357,8 @@
},
"source": [
"## Slow point analysis of a high-dimensional system"
]
],
"id": "f8c9850a60c8a2b0"
},
{
"cell_type": "markdown",
Expand All @@ -366,7 +369,8 @@
"BrainPy is also capable of performing fixed/slow point analysis of high-dimensional systems. Moreover, it can perform automatic linearization analysis around the fixed point.\n",
"\n",
"In the following, we use a gap junction coupled FitzHugh–Nagumo (FHN) network as an example to demonstrate how to find fixed/slow points of a high-dimensional system."
]
],
"id": "a42b23306515127c"
},
{
"cell_type": "markdown",
Expand All @@ -375,7 +379,8 @@
},
"source": [
"We first define the gap junction coupled FHN network as the normal ``DynamicalSystem`` class."
]
],
"id": "24471089c2a5247d"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -424,7 +429,8 @@
" self.V.value = self.int_V(self.V, t, self.w, self.Iext, dt)\n",
" self.w.value = self.int_w(self.w, t, self.V, dt)\n",
" self.Iext[:] = 0."
]
],
"id": "f9fa252ff8617c22"
},
{
"cell_type": "markdown",
Expand All @@ -433,7 +439,8 @@
},
"source": [
"Through simulation, we can easily find that this system has a limit cycle attractor, implying that an unstable fixed point exists."
]
],
"id": "158d89a270070b5d"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -485,7 +492,8 @@
"bp.visualize.line_plot(runner.mon.ts, runner.mon.V, legend='V',\n",
" plot_ids=list(range(model.num)),\n",
" show=True)"
]
],
"id": "58e6a900ff39ff43"
},
{
"cell_type": "markdown",
Expand All @@ -494,7 +502,8 @@
},
"source": [
"Let's try to optimize the fixed points for this system. Note that we only take care of the variables ``V`` and ``w``. Different from the low-dimensional analyzer, we should provide the candidate fixed points or initial fixed points when using the high-dimensional analyzer."
]
],
"id": "22084ff723d5331"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -582,7 +591,8 @@
"\n",
"# remove the duplicate fixed points\n",
"finder.keep_unique()"
]
],
"id": "90ce07cf2a0a8e3c"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -617,7 +627,8 @@
"source": [
"print('fixed points:', )\n",
"finder.fixed_points"
]
],
"id": "45b81a4cdac07efa"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -651,7 +662,8 @@
"source": [
"print('fixed point losses:', )\n",
"finder.losses"
]
],
"id": "adc5767da75ea8b2"
},
{
"cell_type": "markdown",
Expand All @@ -660,7 +672,8 @@
},
"source": [
"Let's perform the linearization analysis of the found fixed points, and visualize its decomposition results."
]
],
"id": "511b2ac23cb0c586"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -694,7 +707,8 @@
],
"source": [
"_ = finder.compute_jacobians(finder.fixed_points, plot=True)"
]
],
"id": "49e773e8700380ce"
},
{
"cell_type": "markdown",
Expand All @@ -703,7 +717,8 @@
},
"source": [
"This is an unstable fixed point, because one of its eigenvalues has the real part bigger than 1."
]
],
"id": "a1a7df686a3bb68f"
},
{
"cell_type": "markdown",
Expand All @@ -712,7 +727,8 @@
},
"source": [
"## Further reading"
]
],
"id": "b9e1a94399ffa6a1"
},
{
"cell_type": "markdown",
Expand All @@ -723,7 +739,8 @@
"- For more details about how to perform bifurcation analysis and phase plane analysis, please see the tutorial of [Low-dimensional Analyzers](../tutorial_analysis/lowdim_analysis.ipynb).\n",
"- A good example of phase plane analysis and bifurcation analysis is the decision-making model, please see the tutorial in [Analysis of a Decision-making Model](../tutorial_analysis/decision_making_model.ipynb)\n",
"- If you want to how to analyze the slow points (or fixed points) of your high-dimensional dynamical models, please see the tutorial of [High-dimensional Analyzers](../tutorial_analysis/highdim_analysis.ipynb)"
]
],
"id": "7a4f436e37606967"
}
],
"metadata": {
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorial_toolbox/synaptic_weights.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
],
"source": [
"bp.__version__"
]
],
"id": "23c6c2fe06bbd897"
},
{
"cell_type": "markdown",
Expand Down

0 comments on commit 9d57224

Please sign in to comment.