#!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().run_line_magic('matplotlib', 'widget') import matplotlib.pyplot as plt import numpy from tvb.simulator.lab import * # # Simulate with the Jansen and Rit model. # # White noise is added to one specific state variable to emulate the external # stochastic stimulus p(t) as described in [JansenRit_1995] # In[2]: jrm = models.JansenRit(mu=numpy.array([0.]), v0=numpy.array([6.])) phi_n_scaling = (jrm.a * jrm.A * (jrm.p_max-jrm.p_min) * 0.5 )**2 / 2. sigma = numpy.zeros(6) sigma[3] = phi_n_scaling # the other aspects of the simulator are standard sim = simulator.Simulator( model=jrm, connectivity=connectivity.Connectivity.from_file(), coupling=coupling.SigmoidalJansenRit(a=numpy.array([10.0])), integrator=integrators.HeunStochastic(dt=2 ** -4, noise=noise.Additive(nsig=sigma)), monitors=(monitors.TemporalAverage(period=2 ** -2),), simulation_length=1e3, ).configure() # run it (time, data), = sim.run() # visualize time series plt.figure() plt.plot(time, data[:, 0, :, 0], 'k', alpha=0.1) plt.title("Temporal Average")