def test_compare_w_neurolib_native_model(self):
     """
     Compare with neurolib's native FitzHugh-Nagumo model.
     """
     # run this model - default is diffusive coupling
     fhn_multi = FitzHughNagumoNetwork(self.SC, self.DELAYS, seed=SEED)
     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
     fhn_neurolib.params["dt"] = DT
     # there is no "global coupling" parameter in MultiModel
     fhn_neurolib.params["K_gl"] = 1.0
     # delays <-> length matrix
     fhn_neurolib.params["signalV"] = 1.0
     fhn_neurolib.params["coupling"] = "diffusive"
     fhn_neurolib.params["sigma_ou"] = 0.0
     fhn_neurolib.params["xs_init"] = fhn_multi.initial_state[::2][:, np.
                                                                   newaxis]
     fhn_neurolib.params["ys_init"] = fhn_multi.initial_state[1::2][:, np.
                                                                    newaxis]
     fhn_neurolib.run()
     for var in NEUROLIB_VARIABLES_TO_TEST:
         corr_mat = np.corrcoef(fhn_neurolib[var],
                                multi_result[var].values.T)
         self.assertTrue(np.greater(corr_mat, CORR_THRESHOLD).all())
Beispiel #2
0
    def test_single_node(self):
        logging.info("\t > FHN: Testing single node ...")
        start = time.time()
        fhn = FHNModel()
        fhn.params["duration"] = 2.0 * 1000
        fhn.params["sigma_ou"] = 0.03

        fhn.run()

        end = time.time()
        logging.info("\t > Done in {:.2f} s".format(end - start))
Beispiel #3
0
    def setUpClass(cls):
        from neurolib.models.fhn import FHNModel

        fhn = FHNModel()
        fhn.run()
        cls.model = fhn

        from neurolib.utils.parameterSpace import ParameterSpace

        pars = ParameterSpace({"x": [1, 2]})
        cls.pars = pars
Beispiel #4
0
    def test_network(self):
        logging.info("\t > FHN: Testing brain network (chunkwise integration and BOLD simulation) ...")
        start = time.time()
        ds = Dataset("gw")
        fhn = FHNModel(Cmat=ds.Cmat, Dmat=ds.Dmat)
        fhn.params["signalV"] = 4.0
        fhn.params["duration"] = 10 * 1000
        fhn.params["sigma_ou"] = 0.1
        fhn.params["K_gl"] = 0.6
        fhn.params["x_ext_mean"] = 0.72

        fhn.run(chunkwise=True, bold=True, append_outputs=True)
        end = time.time()
        logging.info("\t > Done in {:.2f} s".format(end - start))
Beispiel #5
0
 def test_compare_w_neurolib_native_model(self):
     """
     Compare with neurolib's native FitzHugh-Nagumo model.
     """
     # run this model
     fhn_multi = self._create_node()
     multi_result = fhn_multi.run(DURATION, DT, ZeroInput(DURATION, DT).as_array(), backend="numba")
     # run neurolib's model
     fhn = FHNModel(seed=SEED)
     fhn.params["duration"] = DURATION
     fhn.params["dt"] = DT
     fhn.run()
     for var in NEUROLIB_VARIABLES_TO_TEST:
         corr_mat = np.corrcoef(fhn[var], multi_result[var].values.T)
         self.assertTrue(np.greater(corr_mat, CORR_THRESHOLD).all())