diff --git a/examples/example-0.6-custom-model.ipynb b/examples/example-0.6-custom-model.ipynb index 48ea17a5..c9a11403 100644 --- a/examples/example-0.6-custom-model.ipynb +++ b/examples/example-0.6-custom-model.ipynb @@ -29,6 +29,20 @@ "%autoreload 2" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "try:\n", + " import matplotlib.pyplot as plt\n", + "except ImportError:\n", + " import sys\n", + " !{sys.executable} -m pip install matplotlib\n", + " import matplotlib.pyplot as plt" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -223,7 +237,6 @@ } ], "source": [ - "import matplotlib.pyplot as plt\n", "plt.plot(model.t, model.output.T);\n", "plt.xlabel(\"Time [ms]\")\n", "plt.ylabel(\"Activity $x$\")" diff --git a/tests/multimodel/test_fitzhugh_nagumo.py b/tests/multimodel/test_fitzhugh_nagumo.py index ab61f9bc..c4cdfdc7 100644 --- a/tests/multimodel/test_fitzhugh_nagumo.py +++ b/tests/multimodel/test_fitzhugh_nagumo.py @@ -19,7 +19,7 @@ SEED = 42 DURATION = 100.0 DT = 0.1 -CORR_THRESHOLD = 0.99 +CORR_THRESHOLD = 0.95 NEUROLIB_VARIABLES_TO_TEST = ["x", "y"] # dictionary as backend name: format in which the noise is passed @@ -110,7 +110,9 @@ def test_compare_w_neurolib_native_model(self): """ # run this model fhn_multi = self._create_node() - multi_result = fhn_multi.run(DURATION, DT, ZeroInput().as_array(DURATION, DT), backend="numba") + multi_result = fhn_multi.run( + DURATION, DT, ZeroInput(fhn_multi.num_noise_variables).as_array(DURATION, DT), backend="numba" + ) # run neurolib's model fhn = FHNModel(seed=SEED) fhn.params["duration"] = DURATION @@ -159,7 +161,9 @@ def test_compare_w_neurolib_native_model(self): """ # run this model - default is diffusive coupling fhn_multi = FitzHughNagumoNetwork(self.SC, self.DELAYS, seed=SEED) - multi_result = fhn_multi.run(DURATION, DT, ZeroInput().as_array(DURATION, DT), backend="numba") + multi_result = fhn_multi.run( + DURATION, DT, ZeroInput(fhn_multi.num_noise_variables).as_array(DURATION, DT), backend="numba" + ) # run neurolib's model fhn_neurolib = FHNModel(Cmat=self.SC, Dmat=self.DELAYS, seed=SEED) fhn_neurolib.params["duration"] = DURATION diff --git a/tests/multimodel/test_hopf.py b/tests/multimodel/test_hopf.py index f4bc48af..0efce923 100644 --- a/tests/multimodel/test_hopf.py +++ b/tests/multimodel/test_hopf.py @@ -13,7 +13,7 @@ SEED = 42 DURATION = 100.0 DT = 0.1 -CORR_THRESHOLD = 0.99 +CORR_THRESHOLD = 0.95 NEUROLIB_VARIABLES_TO_TEST = ["x", "y"] # dictionary as backend name: format in which the noise is passed @@ -104,7 +104,9 @@ def test_compare_w_neurolib_native_model(self): """ # run this model hopf_multi = self._create_node() - multi_result = hopf_multi.run(DURATION, DT, ZeroInput().as_array(DURATION, DT), backend="numba") + multi_result = hopf_multi.run( + DURATION, DT, ZeroInput(hopf_multi.num_noise_variables).as_array(DURATION, DT), backend="numba" + ) # run neurolib's model hopf_neurolib = HopfModel(seed=SEED) hopf_neurolib.params["duration"] = DURATION @@ -153,7 +155,9 @@ def test_compare_w_neurolib_native_model(self): """ # run this model - default is diffusive coupling hopf_multi = HopfNetwork(self.SC, self.DELAYS, seed=SEED) - multi_result = hopf_multi.run(DURATION, DT, ZeroInput().as_array(DURATION, DT), backend="numba") + multi_result = hopf_multi.run( + DURATION, DT, ZeroInput(hopf_multi.num_noise_variables).as_array(DURATION, DT), backend="numba" + ) # run neurolib's model hopf_neurolib = HopfModel(Cmat=self.SC, Dmat=self.DELAYS, seed=SEED) hopf_neurolib.params["duration"] = DURATION diff --git a/tests/multimodel/test_thalamus.py b/tests/multimodel/test_thalamus.py index 6a64dfe4..4d731392 100644 --- a/tests/multimodel/test_thalamus.py +++ b/tests/multimodel/test_thalamus.py @@ -19,7 +19,7 @@ DURATION = 100.0 DT = 0.01 -CORR_THRESHOLD = 0.95 +CORR_THRESHOLD = 0.9 NEUROLIB_VARIABLES_TO_TEST = [ ("r_mean_EXC", "Q_t"), ("r_mean_INH", "Q_r"), @@ -139,7 +139,9 @@ def test_compare_w_neurolib_native_model(self): """ # run this model thalamus_multi = self._create_node() - multi_result = thalamus_multi.run(DURATION, DT, ZeroInput().as_array(DURATION, DT), backend="numba") + multi_result = thalamus_multi.run( + DURATION, DT, ZeroInput(thalamus_multi.num_noise_variables).as_array(DURATION, DT), backend="numba" + ) # run neurolib's model thlm_neurolib = ThalamicMassModel() thlm_neurolib.params["duration"] = DURATION diff --git a/tests/multimodel/test_wilson_cowan.py b/tests/multimodel/test_wilson_cowan.py index 005f8440..913dc6e1 100644 --- a/tests/multimodel/test_wilson_cowan.py +++ b/tests/multimodel/test_wilson_cowan.py @@ -22,7 +22,7 @@ SEED = 42 DURATION = 100.0 DT = 0.01 -CORR_THRESHOLD = 0.93 +CORR_THRESHOLD = 0.9 NEUROLIB_VARIABLES_TO_TEST = [("q_mean_EXC", "exc"), ("q_mean_INH", "inh")] # dictionary as backend name: format in which the noise is passed @@ -130,7 +130,9 @@ def test_compare_w_neurolib_native_model(self): """ # run this model wc_multi = self._create_node() - multi_result = wc_multi.run(DURATION, DT, ZeroInput().as_array(DURATION, DT), backend="numba") + multi_result = wc_multi.run( + DURATION, DT, ZeroInput(wc_multi.num_noise_variables).as_array(DURATION, DT), backend="numba" + ) # run neurolib's model wc_neurolib = WCModel(seed=SEED) wc_neurolib.params["duration"] = DURATION @@ -183,7 +185,9 @@ def test_compare_w_neurolib_native_model(self): Compare with neurolib's native Wilson-Cowan model. """ wc_multi = WilsonCowanNetwork(self.SC, self.DELAYS) - multi_result = wc_multi.run(DURATION, DT, ZeroInput().as_array(DURATION, DT), backend="numba") + multi_result = wc_multi.run( + DURATION, DT, ZeroInput(wc_multi.num_noise_variables).as_array(DURATION, DT), backend="numba" + ) # run neurolib's model wc_neurolib = WCModel(Cmat=self.SC, Dmat=self.DELAYS, seed=SEED) wc_neurolib.params["duration"] = DURATION diff --git a/tests/multimodel/test_wong_wang.py b/tests/multimodel/test_wong_wang.py index dcdf8dd9..30f8f677 100644 --- a/tests/multimodel/test_wong_wang.py +++ b/tests/multimodel/test_wong_wang.py @@ -24,7 +24,7 @@ SEED = 42 DURATION = 100.0 DT = 0.1 -CORR_THRESHOLD = 0.95 +CORR_THRESHOLD = 0.9 # dictionary as backend name: format in which the noise is passed BACKENDS_TO_TEST = {