From 9d5722490b8193139847f624b1a099ab59bc1b70 Mon Sep 17 00:00:00 2001 From: Chaoming Wang Date: Tue, 18 Jun 2024 12:39:52 +0800 Subject: [PATCH] updates --- brainpy/_src/math/compat_numpy.py | 4 +- brainpy/math/compat_numpy.py | 4 -- docs/quickstart/analysis.ipynb | 51 +++++++++++++------- docs/tutorial_toolbox/synaptic_weights.ipynb | 3 +- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/brainpy/_src/math/compat_numpy.py b/brainpy/_src/math/compat_numpy.py index 195fd5674..2c030e4e8 100644 --- a/brainpy/_src/math/compat_numpy.py +++ b/brainpy/_src/math/compat_numpy.py @@ -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', @@ -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)) diff --git a/brainpy/math/compat_numpy.py b/brainpy/math/compat_numpy.py index ad6c8184f..3ff45ebcf 100644 --- a/brainpy/math/compat_numpy.py +++ b/brainpy/math/compat_numpy.py @@ -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, diff --git a/docs/quickstart/analysis.ipynb b/docs/quickstart/analysis.ipynb index d8b62de11..49a7d38d4 100644 --- a/docs/quickstart/analysis.ipynb +++ b/docs/quickstart/analysis.ipynb @@ -78,7 +78,8 @@ ], "source": [ "bp.__version__" - ] + ], + "id": "b9f06f10049d4a8c" }, { "cell_type": "markdown", @@ -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", @@ -355,7 +357,8 @@ }, "source": [ "## Slow point analysis of a high-dimensional system" - ] + ], + "id": "f8c9850a60c8a2b0" }, { "cell_type": "markdown", @@ -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", @@ -375,7 +379,8 @@ }, "source": [ "We first define the gap junction coupled FHN network as the normal ``DynamicalSystem`` class." - ] + ], + "id": "24471089c2a5247d" }, { "cell_type": "code", @@ -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", @@ -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", @@ -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", @@ -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", @@ -582,7 +591,8 @@ "\n", "# remove the duplicate fixed points\n", "finder.keep_unique()" - ] + ], + "id": "90ce07cf2a0a8e3c" }, { "cell_type": "code", @@ -617,7 +627,8 @@ "source": [ "print('fixed points:', )\n", "finder.fixed_points" - ] + ], + "id": "45b81a4cdac07efa" }, { "cell_type": "code", @@ -651,7 +662,8 @@ "source": [ "print('fixed point losses:', )\n", "finder.losses" - ] + ], + "id": "adc5767da75ea8b2" }, { "cell_type": "markdown", @@ -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", @@ -694,7 +707,8 @@ ], "source": [ "_ = finder.compute_jacobians(finder.fixed_points, plot=True)" - ] + ], + "id": "49e773e8700380ce" }, { "cell_type": "markdown", @@ -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", @@ -712,7 +727,8 @@ }, "source": [ "## Further reading" - ] + ], + "id": "b9e1a94399ffa6a1" }, { "cell_type": "markdown", @@ -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": { diff --git a/docs/tutorial_toolbox/synaptic_weights.ipynb b/docs/tutorial_toolbox/synaptic_weights.ipynb index 312fa831f..dfa6c5133 100644 --- a/docs/tutorial_toolbox/synaptic_weights.ipynb +++ b/docs/tutorial_toolbox/synaptic_weights.ipynb @@ -71,7 +71,8 @@ ], "source": [ "bp.__version__" - ] + ], + "id": "23c6c2fe06bbd897" }, { "cell_type": "markdown",