OSCR

Alterations in topological and dynamical parameters correlate with disease biomarkers and neuropsychological scores in prodromic stages of dementia.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 1 match
  1. [1] § Methods › Virtual brain modelling ↔ TVB_rww_notebook.ipynb, lines 147–175 · score 0.74 · Wong Wang, neural mass model, fMRI, BOLD signal, global coupling, denotes

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Jupyter notebook · 579 lines · 25 KB · no license · 1 match

  1. # %% [markdown]
  2. # <h1 align="center"><font size="7" face="arial" color="#D9027D">Modelling Resting State with TVB</font></h1>
  3. # %% [markdown]
  4. # <h3 align="center"><span style="font-weight:normal"><font size="4.5" face="arial">
  5. # Anita Monteverdi, Fulvia Palesi, Marta Gaviraghi, and Roberta Maria Lorenzi </font></span></h3>
  6. # %% [markdown]
  7. # <h1><font size="6" face="arial" color="#BF026D">Context</font></h1>
  8. #
  9. # ***
  10. #
  11. # <p><div style="text-align: justify"><font size="4.5" face="time roman">A current topic in system neuroscience literature is the presence of brain activity in the absence of a task condition. These task-negative, spontaneous fluctuations occur in the so-called <b>rest state</b>, and a recurring theme of these fluctuations is that they have a network structure. Because TVB uses the structural connectivity of the brain as the backbone for simulating spontaneous activity, resting state activity and its network structure is a prime candidate for modeling in TVB.</font></div></p>
  12. # %% [markdown]
  13. # <h1><font size="6" face="arial" color="#BF026D">Objectives</font></h1>
  14. #
  15. # ***
  16. #
  17. # <p><div style="text-align: justify"><font size="4.5" face="time roman">In this notebook, we will start from <b>Zimmerman et al, 2018 </b> to:
  18. # <br>
  19. # <ul>
  20. # <li>Build a brain network model using subject-specific structural connectivity,</li>
  21. # <li>Globally optimize parameters of the models,</li>
  22. # <li>Define and simulate dynamics of the whole brain at rest,</li>
  23. # <li>Characterize the resting-state activity using the functional connectivity (FC).</li></ul></font></div></p>
  24. #
  25. # </br>
  26. # <br>
  27. # <p><div style="text-align: justify"><font size="4.5" face="time roman"><u>References:</u></font></div></p>
  28. # <p><div style="text-align: justify"><font size="4.5" face="time roman"><blockquote>
  29. # <li> Zimmermann, J., Perry, A., Breakspeare, M. et al. <b> Differentiation of Alzheimer's disease based on local and global parameters in personalized Virtual Brain models.</b> NeuroImage:Clinical, 2018, 19, 240-251.</li>
  30. # %% [markdown]
  31. # <h1><font size="6" face="arial" color="#BF026D">Exercise</font></h1>
  32. #
  33. # ***
  34. #
  35. # <p><div style="text-align: justify"><font size="4.5" face="time roman"></font></div></p>
  36. #
  37. # <h2><font size="5"face="arial" color="black">How to do it with TVB?</font></h2>
  38. #
  39. # <p><div style="text-align: justify"><font size="4.5" face="time roman">In the first part of this tutorial, we presents the basic anatomy of a region simulation using The Virtual Brain scripting interface.
  40. # The first thing we want to do is to import the modules we will need for a simulation.</font></div></p>
  41. # %%
  42. %pip install tvb
  43. # %%
  44. %matplotlib inline
  45. # %%
  46. %%capture
  47. # Import a bunch of stuff to ease command line usage
  48. import os
  49. import numpy as np
  50. import time as tm
  51. import matplotlib
  52. import matplotlib.pyplot as plt
  53. from tvb.simulator.lab import *
  54. from tvb.datatypes.time_series import TimeSeriesRegion
  55. from tvb.datatypes import graph
  56. # %% [markdown]
  57. # <h1><font size="5.5" face="arial" color="black">1. Load and prepare connectivity data</font></h1>
  58. #
  59. # <p><div style="text-align: justify"><font size="4.5" face="time roman">Load in and prepare the structural connectivity and functional connectivity from the source we are using.</font></div></p>
  60. #
  61. # <h2><font size="4.5"face="arial" color="black"> Subject-specific structural connectivity</font></h2>
  62. #
  63. # <p><div style="text-align: justify"><font size="4.5" face="time roman">Here, we use a <b>Structural Connectivity (SC) of 126 regions</b> derived from Diffusion Weighted Imaging (DWI) and Constrained Spherical Deconvolution tractography, as previously published in <b>Palesi et al. (2020)</b>. Connections in this SC matrix were defined with an ad-hoc parcellation scheme combining cerebral cortical and subcortical parcellations (<b>Tzourio-Mazoyer et al., 2002</b>) with cerebellar ones (SUIT, <b>Diedrichsen et al., 2009</b>).
  64. # <br>We start by loading and visualizing the SC matrix that represents the set of all existing connections between brain areas.</font></div></p>
  65. #
  66. # <h2><font size="4.5"face="arial" color="black"> Subject-specific functional connectivity</font></h2>
  67. #
  68. # <p><div style="text-align: justify"><font size="4.5" face="time roman">For the same subject, we use a static <b>Functional Connectivity (FC) </b> whose edges were defined as the correlation between the time-courses of pairs of the 126 regions.
  69. # <br>We start by loading and visualizing the SC matrix that represents the set of all existing connections between brain areas.</font></div></p>
  70. #
  71. # <p><div style="text-align: justify"><font size="4.5" face="time roman"><u>References:</u></font></div></p>
  72. # <p><div style="text-align: justify"><font size="4.5" face="time roman"><blockquote>(Palesi et al., 2020): Palesi, F., Lorenzi, R. M., Casellato, C., Ritter, P., Jirsa, V., Wheeler- kingshott, C. A. M. G., and Angelo, E. D. (2020). <b>The importance of cerebellar connectivity on simulated brain dynamics. </b>Frontiers in Cellular Neuroscience, 14,1–11. <br />
  73. # <br>(Monteverdi et al., 2022): Monteverdi A, Palesi F, Costa A, Vitali P, Pichiecchio A, Cotta Ramusino M, Bernini S, Jirsa V,
  74. # Gandini Wheeler-Kingshott CAM and D’Angelo E (2022) <b>Subject-specific features of excitation/inhibition profiles in neurodegenerative diseases.</b>
  75. # Front. Aging Neurosci. 14:868342. doi: 10.3389/fnagi.2022.868342<br />
  76. # <br>(Tzourio-Mazoyer et al., 2002): Tzourio-Mazoyer, N., Landeau, B., Papathanassiou, D., Crivello, F., Etard, O., Delcroix, N., et al. (2002). <b>Automated anatomical labeling ofactivations in SPM using a macroscopic anatomical parcellation of the MNI MRI single-subject brain. </b>Neuroimage 15, 273–289. doi: 10.1006/nimg.2001.0978.<br />
  77. # <br>(Diedrichsen et al., 2009): Diedrichsen, J., Balsters, J. H., Flavell, J., Cussans, E., and Ramnani, N. (2009). <b>A probabilistic MR atlas of the human cerebellum.</b> Neuroimage 46, 39–46. doi: 10.1016/j.neuroimage.2009.01.045.<br /></blockquote></font></div></p>
  78. # %%
  79. from google.colab import drive
  80. drive.mount('/content/gdrive')
  81. # %%
  82. # Change the path of your Google Drive with the Tutorial folder
  83. root_path = '/content/gdrive/MyDrive/04_TVB/'
  84. # %%
  85. # Define paths for importing empirical structural (SC) and functional connectivity (FC)
  86. pathSC = root_path + 'TVB_data/Conn_plusCRBL.zip'
  87. pathFC = root_path + 'TVB_data/functZ_sparse.txt'
  88. # %%
  89. # Import empirical connectivities
  90. #STRUCTURAL
  91. con = connectivity.Connectivity.from_file(pathSC)
  92. #Define the average axonal speed
  93. con.speed = np.array(10)
  94. print ('')
  95. print ('Maximum SC value = %10.4f' % np.max(con.weights))
  96. #FUNCTIONAL
  97. con_FC = np.genfromtxt(pathFC)
  98. # %%
  99. # Visualize the empirical SC, time delays along SC edges, and FC matrices
  100. fig=plt.figure(figsize=(12,5))
  101. #labels=con.region_labels[0:126:5]
  102. labels=con.region_labels[0:-1:5]
  103. # SC
  104. plt.subplot(131)
  105. #cs=imshow(np.log10(con.weights), cmap='jet', aspect='equal', interpolation='none')
  106. cs=plt.imshow(con.weights, interpolation='none', aspect='equal', cmap='jet', vmax=0.005)
  107. plt.title('Empirical SC', fontsize=14)
  108. plt.xticks(np.arange(0, len(con.region_labels)-1, step=5), labels, fontsize=7, rotation=90)
  109. plt.yticks(np.arange(0, len(con.region_labels)-1, step=5), labels, fontsize=7)
  110. axcb=plt.colorbar(cs, shrink=0.4)
  111. axcb.set_label('weights', fontsize=11)
  112. #delays
  113. plt.subplot(132)
  114. plt.imshow(con.tract_lengths/con.speed, interpolation='none', aspect='equal', cmap='jet')
  115. plt.title('Conduction delays', fontsize=14)
  116. axcb=plt.colorbar(shrink=0.4)
  117. axcb.set_label('delays [ms]', fontsize=11)
  118. # empirical FC
  119. plt.subplot(133)
  120. plt.imshow(con_FC, interpolation='nearest', aspect='equal', cmap='jet')
  121. plt.title('Empirical FC', fontsize=14)
  122. cb=plt.colorbar(shrink=0.4, ticks=[-0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
  123. cb.set_label('PPC', fontsize=11)
  124. plt.show
  125. # %% [markdown]
  126. # <h3><font size="5" face="arial" color="black"> 2 Model</font></h3>
  127. #
  128. #
  129. # <p><div style="text-align: justify"><font size="4.5" face="time roman">In this tutorial, we will use a computational model of resting-state network dynamics: the <b>Reduced Wong-Wang</b>, previously introduced in <b>(Hansen et al., 2015)</b>. This model is a reduction of the model presented in <b>(Wong &#38; Wang, 2006)</b> to a single population model and used in a modeling study of resting-state <b>(Deco et al., 2013; Hansen et al., 2015)</b>. The neural activity of each node is given by the following equations:</font></div></p>
  130. #
  131. # \begin{eqnarray}
  132. # \dfrac{\text{d}S_{i}}{\text{d}t} &=& \dfrac{-S_{i}}{\tau_{s}} + \gamma \ (1 - S_{i})\ H(x_{i}) + \sigma\eta_{i}(t)\\
  133. # &\\
  134. # H(x_{i}) &=& \dfrac{ax_{i} - b}{1 - \exp(-d \ (ax_{i} - b))}\\
  135. # &\\
  136. # x_{i} &=& wJ_{N}S_{i} + J_{N}G\sum_{j}C_{ij}S_{j} + I_{0}
  137. # \end{eqnarray}
  138. #
  139. # <p><div style="text-align: justify"><font size="4.5" face="time roman">where $S_{i}$ denotes the average synaptic gating variable at the local area $i$, $H(x_{i})$ is a sigmoid function that converts the input synaptic activity $x_{i}$ into an output population firing rate.</font></div></p>
  140. # <p><div style="text-align: justify"><font size="4.5" face="time roman">$C_{ij}$ are the entries of the anatomical structural connectivity matrix reweigthed by the global coupling parameter $G$, with which we will study the optimal dynamical working region where the simulations maximally fit the empirical FC. $\eta_{i}(t)$ is a Gaussian white noise with a noise amplitude $\sigma = 0.001.$</font></div></p>
  141. #
  142. #
  143. # <p><div style="text-align: justify"><font size="4.5" face="time roman">This <b>biologically realistic</b> neural mass model is able to reproduce <b>time-averaged resting state FC</b> as well as the recently introduced <b>FC dynamics</b> with fMRI BOLD signals.</font></div></p>
  144. #
  145. # <p><div style="text-align: justify"><font size="4.5" face="time roman"><u>References:</u></font></div></p>
  146. # <p><div style="text-align: justify"><font size="4.5" face="time roman"><blockquote>(Wong &#38; Wang, 2006): Wong, K.-F. &#38; Wang, X.-J. <b>A recurrent network mechanism of time integration in perceptual decision.</b> J. Neurosci., 2006, 26, 1314-1328. <br />
  147. # <br>(Deco et al., 2013): Deco, G., Ponce-Alvarez, A., Mantini, D., Romani, G.L., Hagmann, P. &#38; Corbetta, M. <b>Resting-state functional connectivity emerges from structurally and dynamically shaped slow linear fluctuations.</b> J. Neurosci., 32(27), 11239-11252, 2013.<br />
  148. # <br>(Hansen et al., 2015): Hansen, E.C., Battaglia, D., Spiegler, A., Deco, G. &#38; Jirsa V.K. <b>Functional connectivity dynamics: modeling the switching behavior of the resting-state.</b> NeuroImage, 105(2015), 525-535.<br />
  149. # %%
  150. # Initialise a Model.
  151. g2d = models.ReducedWongWang()
  152. g2d
  153. # %% [markdown]
  154. # <h3><font size="5"face="arial" color="black"> 3 Coupling function</font></h3>
  155. # <p><div style="text-align: justify"><font size="4.5" face="time roman">The coupling function is used to join the local model dynamics at distinct spatial locations.</font></div></p>
  156. # %%
  157. # Initialise a Coupling function.
  158. G = np.array(7.5)
  159. con_coupling = coupling.Scaling(a=G)
  160. # %% [markdown]
  161. # <h3><font size="5"face="arial" color="black"> 4 Integrator</font></h3>
  162. # <p><div style="text-align: justify"><font size="4.5" face="time roman">Now that we have defined our structure and dynamics, we need to select an integration scheme.
  163. #
  164. # <br>We use a stochastic integration scheme where the noise is added. The shape of the noise must correspond to the number of state variables in neural mass models, here equal to 1.
  165. # We integrate the coupling and the stochastic terms using a <b>HeunStochastic</b> method, otherwise you can use the detrministic version <b>HeunDeterministic</b>. The step size for the simulation is 0.5.
  166. # <br>By default in TVB, the stochastic method assumes that the standard deviation of the noise is a constant equal to: $\sqrt{(2\sigma)}$.
  167. #
  168. # <br>
  169. #
  170. # <b>NOTE</b> that the most important thing here is to use a step size that is small enough for the integration to be numerically stable.</font></div></p>
  171. # %%
  172. # Initialise an Integrator scheme.
  173. dt = 0.5 #integration steps [ms]
  174. #Change dt to assess how much it impact on the final results
  175. # We can use the deteministic integrator:
  176. # heunint = integrators.HeunDeterministic(dt=dt)
  177. D = 0.001 #standard deviation of the noise
  178. heunstoc=integrators.HeunStochastic(dt=dt, noise=noise.Additive(nsig=np.array([(D**2)/2])))
  179. # %% [markdown]
  180. # <h3><font size="5"face="arial" color="black"> 5 Monitors</font></h3>
  181. # <p><div style="text-align: justify"><font size="4.5" face="time roman">The last component is Monitor: observer models.
  182. #
  183. # <br>Here we select two monitors to get the time series of the model state variables. First, one of the simplest:
  184. #
  185. # * the <b>TemporalAverage</b> monitor averages over a time window of length period returning one time point every period (given in ms).
  186. #
  187. # Then, among other Monitors which apply a biophysical measurement process to the simulated neural activity, such as EEG, MEG, etc, we would like to relate the simulated neural activity to recent fMRI studies, thus we chose:
  188. #
  189. # * the <b>BOLD</b> monitor to generate BOLD signal for each regions by using a hemodynamic model.</font></div></p>
  190. # %%
  191. # Initialise some Monitors with period in physical time.
  192. mon_tavg = monitors.TemporalAverage(period=1.) #1000 Hz
  193. TR = 720
  194. mon_bold = monitors.Bold(period=TR)
  195. #Bundle them
  196. what_to_watch = (mon_tavg,mon_bold)
  197. # %% [markdown]
  198. # <h1 align="center"><font size="6"face="arial" color="black">Go! Simulate</font></h1>
  199. #
  200. # <p><div style="text-align: justify"><font size="4.5" face="time roman">The last step is to bring all these components together into a <b>Simulator</b> object. We then need to run the configure method, which basically just acts to calculate information necessary for the simulation that draws on specific combinations of the components.</font></div></p>
  201. # %%
  202. # Initialise the Simulator.
  203. regime={'w':np.array(1.), 'I_o':np.array(0.3)}
  204. sim = simulator.Simulator(
  205. model=models.ReducedWongWang(**regime),
  206. connectivity=con,
  207. coupling=con_coupling,
  208. conduction_speed=float(con.speed),
  209. integrator=heunstoc,
  210. monitors=what_to_watch)
  211. sim.initial_conditions = 0.001*np.ones((1, 1, con.weights.shape[0], 1))
  212. sim.configure()
  213. # %% [markdown]
  214. # <p><div style="text-align: justify"><font size="4.5" face="time roman">Now, we can run the simulation. All we need to do is iterate for some length, which we provide in *ms*, and collect the output.
  215. #
  216. # The data returned by the simulator is in the form of a list of arrays.</font></div></p>
  217. # %%
  218. # Perform the simulation.
  219. tic = tm.time()
  220. tavg_data, tavg_time = [], []
  221. bold_data, bold_time = [], []
  222. for tavg, bold in sim(simulation_length=360000.):
  223. if not tavg is None:
  224. tavg_time.append(tavg[0])
  225. tavg_data.append(tavg[1])
  226. if not bold is None:
  227. bold_time.append(bold[0])
  228. bold_data.append(bold[1])
  229. 'simulation required %0.3f seconds.' % (tm.time()-tic)
  230. # %% [markdown]
  231. # <h1 align="center"><font size="6"face="arial" color="black">Visualize our simulation</font></h1>
  232. #
  233. # <p><div style="text-align: justify"><font size="4.5" face="time roman">And finally, we can look at the results of our simulation, first in terms of time series...</font></div></p>
  234. # %%
  235. # Normalize the time series
  236. tavg_data /= (np.max(tavg_data, 0) - np.min(tavg_data, 0))
  237. # Make the lists numpy.arrays for easier use.
  238. TAVG = np.squeeze(np.array(tavg_data))
  239. # Plot the temporally averaged time series
  240. fig2 = plt.figure(figsize=(12,8))
  241. plt.subplot(3,1,1)
  242. plt.plot(tavg_time[:], TAVG[:, 0], 'r')
  243. plt.ylabel(con.region_labels[0],fontsize=13)
  244. plt.subplot(3,1,2)
  245. plt.plot(tavg_time[:], TAVG[:, 1], 'c')
  246. plt.ylabel(con.region_labels[1],fontsize=13)
  247. plt.subplot(3,1,3)
  248. plt.plot(tavg_time[:], TAVG[:, 2], 'g')
  249. plt.xlabel('Time [ms]', fontsize=13)
  250. plt.ylabel(con.region_labels[2],fontsize=13)
  251. plt.show()
  252. # %% [markdown]
  253. # <p><div style="text-align: justify"><font size="4.5" face="time roman">...And then reconstructing the simulated FC</font></div></p>
  254. # %%
  255. def eval_fc(tsr):
  256. input_shape = tsr.data.shape
  257. result_shape = (input_shape[2], input_shape[2], input_shape[1], input_shape[3])
  258. result = np.zeros(result_shape)
  259. for mode in range(result_shape[3]):
  260. for var in range(result_shape[2]):
  261. data = tsr.data[:,var,:, mode].squeeze()
  262. result[:, :, var, mode] = np.corrcoef(data.T)
  263. corr_coeff = graph.CorrelationCoefficients(source=tsr, array_data=result)
  264. return corr_coeff
  265. # %%
  266. # Discarded first 10 volumes
  267. data = np.array(bold_data[10:int(360000/720)])
  268. # Build a TimeSeries Dataype
  269. tsr = TimeSeriesRegion(connectivity=con,
  270. data=data,
  271. sample_period=sim.monitors[1].period)
  272. tsr.configure()
  273. # Compute FC
  274. corrcoeff_data = eval_fc(tsr)
  275. FC = corrcoeff_data.array_data[..., 0, 0]
  276. empFC_wb = np.triu(con_FC, 1) #triangle matrix
  277. simFC_wb = np.triu(FC, 1)
  278. pcc_wb = np.corrcoef(empFC_wb.ravel(), simFC_wb.ravel())[0, 1]
  279. print ('Similarity between empFC and simFC in the whole-brain network: %10.4f' % pcc_wb)
  280. # Visualize and compare the simulated FC and the empirical FC
  281. fig=plt.figure(figsize=(17,7))
  282. # whole-brain network: FC_wb
  283. plt.subplot(131)
  284. p1=plt.imshow(FC, interpolation='nearest', aspect='equal', cmap='jet')
  285. plt.title('Whole-brain simFC', fontsize=14)
  286. cb1=plt.colorbar(p1, shrink=0.325, ticks=[-0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
  287. plt.subplot(132)
  288. p1=plt.imshow(con_FC, interpolation='nearest', aspect='equal', cmap='jet')
  289. plt.title('Whole-brain empFC', fontsize=14)
  290. cb1=plt.colorbar(p1, shrink=0.325, ticks=[-0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
  291. # %% [markdown]
  292. # <h1 align="center"><font size="6"face="arial" color="#BF026D">Optimize the model!</font></h1>
  293. #
  294. # <p><div style="text-align: justify"><font size="4.5" face="time roman">The simulation is ended but the model wasn't tune and optimize. Here we add a function for the optimization steps. </font></div></p>
  295. # %%
  296. def run_rww_sim_pcc(con, G, regime, D, dt, TR, simlen):
  297. # Initialise Simulator.
  298. sim = simulator.Simulator(
  299. model=models.ReducedWongWang(**regime),
  300. connectivity=con,
  301. coupling=coupling.Scaling(a=np.array(G)),
  302. conduction_speed=float(con.speed),
  303. integrator=integrators.HeunStochastic(dt=dt, noise=noise.Additive(nsig=np.array([(D**2)/2]))),
  304. monitors=(monitors.Bold(period=TR),)
  305. )
  306. sim.initial_conditions = (0.001)*np.ones((1, 1, con.weights.shape[0], 1))
  307. sim.configure()
  308. # Lunch simulation
  309. (t, B), = sim.run(simulation_length=simlen)
  310. # Remove transcient time
  311. B = B[10:int(simlen/TR), :, :, :]
  312. # Built a TiemSeries Datatype
  313. tsr = TimeSeriesRegion(connectivity=con,
  314. data=B,
  315. sample_period=sim.monitors[0].period)
  316. tsr.configure()
  317. # Compute FC
  318. corrcoeff_data = eval_fc(tsr)
  319. FC = corrcoeff_data.array_data[..., 0, 0]
  320. # Take triangular upper part of FC
  321. FC_triu = np.triu(FC, 1)
  322. # Compute Pearson correlation
  323. pcc_FC = np.corrcoef(np.triu(con_FC, 1).ravel(), FC_triu.ravel())[0, 1]
  324. pcc_SC = np.corrcoef(np.triu(con.weights, 1).ravel(), FC_triu.ravel())[0, 1]
  325. return pcc_FC, pcc_SC
  326. # %%
  327. #IT TAKES ABOUT 15-20 MINUTES
  328. tic = tm.time()
  329. # Run G sweep
  330. Gs = np.arange(5, 30, 0.5)
  331. regime = {'a': np.array(270.), 'b':np.array(108.), 'd':np.array(0.154),
  332. 'gamma':np.array(0.641/1000), 'w':np.array(1.), 'I_o':np.array(0.3)}
  333. pcc_FC = np.zeros((len(Gs)))
  334. pcc_SC = np.zeros((len(Gs)))
  335. print('simulation start.')
  336. for iG, G in enumerate(Gs):
  337. print("simulation : G %1.1f" % G)
  338. pcc_FC[iG], pcc_SC[iG] = run_rww_sim_pcc(con, Gs[iG], regime, 0.001, 1, 720, 60000)
  339. 'simulation required %0.3f seconds.' % (tm.time()-tic)
  340. # %%
  341. #DON'T RUN THIS CELL IF YOU DIDN'T RUN THE CELL ABOVE
  342. # Visualize
  343. plt.figure(figsize=(10,8))
  344. # FC and SC
  345. plt.plot(Gs, pcc_FC, '-*', label='FC - FC')
  346. plt.plot(Gs, pcc_SC, '-*g', label='SC - FC')
  347. plt.xlabel('$G_{coupl}$', fontsize=20);
  348. plt.title('Correlation Diagram', fontsize=20)
  349. plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
  350. plt.show()
  351. Gopt = Gs[np.argmax(pcc_FC)]
  352. print ('The optimal value for the global coupling is: %5.1f' % Gopt)
  353. # %%
  354. # Initialise a Coupling function at the optimal value of G
  355. G = np.array(26)
  356. con_coupling = coupling.Scaling(a=G)
  357. # %%
  358. #IT IS NOT NEEDED SINCE WE HAVE ALREADY INITIALISED IT
  359. # Initialise an Integrator scheme.
  360. dt = 0.5 #integration steps [ms]
  361. D = 0.001 #standard deviation of the noise
  362. heunstoc=integrators.HeunStochastic(dt=dt, noise=noise.Additive(nsig=np.array([(D**2)/2])))
  363. # %%
  364. #IT IS NOT NEEDED SINCE WE HAVE ALREADY INITIALISED IT
  365. # Initialise some Monitors with period in physical time.
  366. mon_tavg = monitors.TemporalAverage(period=1.) #1000 Hz
  367. TR = 720
  368. mon_bold = monitors.Bold(period=TR)
  369. #Bundle them
  370. what_to_watch = (mon_tavg,mon_bold)
  371. # %%
  372. # Initialise the Simulator.
  373. regime={'w':np.array(1.), 'I_o':np.array(0.3)}
  374. sim = simulator.Simulator(
  375. model=models.ReducedWongWang(**regime),
  376. connectivity=con,
  377. coupling=con_coupling,
  378. conduction_speed=float(con.speed),
  379. integrator=heunstoc,
  380. monitors=what_to_watch)
  381. sim.initial_conditions = 0.001*np.ones((1, 1, con.weights.shape[0], 1))
  382. sim.configure()
  383. # %%
  384. # Perform the simulation.
  385. tic = tm.time()
  386. tavg_data, tavg_time = [], []
  387. bold_data, bold_time = [], []
  388. for tavg, bold in sim(simulation_length=360000.):
  389. if not tavg is None:
  390. tavg_time.append(tavg[0])
  391. tavg_data.append(tavg[1])
  392. if not bold is None:
  393. bold_time.append(bold[0])
  394. bold_data.append(bold[1])
  395. 'simulation required %0.3f seconds.' % (tm.time()-tic)
  396. # %% [markdown]
  397. # <p><div style="text-align: justify"><font size="4.5" face="time roman">Visualize the simulation</font></div></p>
  398. # %%
  399. # Normalize the time series
  400. tavg_data /= (np.max(tavg_data, 0) - np.min(tavg_data, 0))
  401. # Make the lists numpy.arrays for easier use.
  402. TAVG = np.squeeze(np.array(tavg_data))
  403. # Plot the temporally averaged time series
  404. fig2 = plt.figure(figsize=(12,8))
  405. plt.subplot(3,1,1)
  406. plt.plot(tavg_time[:], TAVG[:, 0], 'r')
  407. plt.ylabel(con.region_labels[0],fontsize=13)
  408. plt.subplot(3,1,2)
  409. plt.plot(tavg_time[:], TAVG[:, 1], 'c')
  410. plt.ylabel(con.region_labels[1],fontsize=13)
  411. plt.subplot(3,1,3)
  412. plt.plot(tavg_time[:], TAVG[:, 2], 'g')
  413. plt.xlabel('Time [ms]', fontsize=13)
  414. plt.ylabel(con.region_labels[2],fontsize=13)
  415. plt.show()
  416. # %%
  417. # Normalize the time series
  418. tavg_data /= (np.max(tavg_data, 0) - np.min(tavg_data, 0))
  419. # Make the lists numpy.arrays for easier use.
  420. TAVG = np.squeeze(np.array(tavg_data))
  421. # Plot the temporally averaged time series
  422. fig2 = plt.figure(figsize=(12,8))
  423. plt.subplot(3,1,1)
  424. plt.plot(tavg_time[10:int(360000/720)], TAVG[10:int(360000/720), 0], 'r')
  425. plt.ylabel(con.region_labels[0],fontsize=13)
  426. plt.subplot(3,1,2)
  427. plt.plot(tavg_time[10:int(360000/720)], TAVG[10:int(360000/720), 1], 'c')
  428. plt.ylabel(con.region_labels[1],fontsize=13)
  429. plt.subplot(3,1,3)
  430. plt.plot(tavg_time[10:int(360000/720)], TAVG[10:int(360000/720), 2], 'g')
  431. plt.xlabel('Time [ms]', fontsize=13)
  432. plt.ylabel(con.region_labels[2],fontsize=13)
  433. plt.show()
  434. # %% [markdown]
  435. # <p><div style="text-align: justify"><font size="4.5" face="time roman">...And then reconstructing the simulated FC</font></div></p>
  436. # %%
  437. # Discarded first 10 volumes
  438. data = np.array(bold_data[10:int(360000/720)])
  439. # Build a TimeSeries Dataype
  440. tsr = TimeSeriesRegion(connectivity=con,
  441. data=data,
  442. sample_period=sim.monitors[1].period)
  443. tsr.configure()
  444. # Compute FC
  445. corrcoeff_data = eval_fc(tsr)
  446. FC = corrcoeff_data.array_data[..., 0, 0]
  447. empFC_wb = np.triu(con_FC, 1) #triangle matrix
  448. simFC_wb = np.triu(FC, 1)
  449. pcc_wb = np.corrcoef(empFC_wb.ravel(), simFC_wb.ravel())[0, 1]
  450. print ('Similarity between empFC and simFC in the whole-brain network: %10.4f' % pcc_wb)
  451. # Visualize and compare the simulated FC and the empirical FC
  452. fig=plt.figure(figsize=(17,7))
  453. # whole-brain network: FC_wb
  454. plt.subplot(131)
  455. p1=plt.imshow(FC, interpolation='nearest', aspect='equal', cmap='jet')
  456. plt.title('Whole-brain simFC', fontsize=14)
  457. cb1=plt.colorbar(p1, shrink=0.325, ticks=[-0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
  458. plt.subplot(132)
  459. p1=plt.imshow(con_FC, interpolation='nearest', aspect='equal', cmap='jet')
  460. plt.title('Whole-brain empFC', fontsize=14)
  461. cb1=plt.colorbar(p1, shrink=0.325, ticks=[-0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
  462. # %% [markdown]
  463. # <h1><font size="6" face="arial" color="#BF026D">Now, it's up to you!!</font></h1>
  464. #
  465. # ***
  466. #
  467. # <p><div style="text-align: justify"><font size="4.5" face="time roman">These results are starting point for modelling resting state, from which we can base our next simulations.
  468. #
  469. # You can choose one of the following further analyses:
  470. # <br>
  471. #
  472. # * Change the integration step of the Heun Stocastic integrator. Try with 1. What does it change?
  473. # * <b>Generate optimal whole-brain dynamics in a pathological subject</b>, like an Alzheimer's disease patient. To do this you can use data from files ending with _AD. **(TR = 3010 ms, simlen = 360000 ms)**
  474. # * <b>Simulate optimal brain dynamics in a local circuit </b> instead of whole-brain network. To do this you have to define a network that contains only few specific regions that are known to be functinally related one another. For example, the first 93 nodes are belonging to the cerebral connectivity. <i>Tip: for SC you have to set con.weights con.tract_lengths con.centres con.region_labels </i>
  475. #
  476. # </font></div></p>

TVB_rww_notebook.ipynb at commit 0aa8af8, no license · at the source

Overview

Authors: Anita Monteverdi1, Matteo Cotta Ramusino2, Francesca Conca3, Sofia Manzon4, Alberto Redolfi5, Eleonora Lupi4, Marialaura De Grazia4, Roberta Maria Lorenzi4, Marta Gaviraghi4, Laura Mazzocchi6, Lisa M. Farina6, Alfredo Costa2,4, Anna Pichiecchio4,6, Stefano F. Cappa3,7, Claudia A. M. Gandini Wheeler-Kingshott1,4,8, Fulvia Palesi1,4, Egidio D’Angelo1,4
  1. Digital Neuroscience Centre, IRCCS Mondino Foundation,Pavia, Italy
  2. Unit of Behavioral Neurology, IRCCS Mondino Foundation,Pavia, Italy
  3. Institute for Advanced Studies (IUSS),Pavia, Italy
  4. Department of Brain and Behavioral Sciences, University of Pavia,Pavia, Italy
  5. Laboratory of Neuroinformatics, IRCCS Istituto Centro San Giovanni di Dio Fatebenefratelli,Brescia, Italy
  6. Advanced Imaging and Artificial Intelligence Center, IRCCS Mondino Foundation,Pavia, Italy
  7. IRCCS Istituto Auxologico Italiano,Milan, Italy
  8. Department of Neuroinflammation, Queen Square Multiple Sclerosis Centre, NMR Research Unit, UCL Queen Square Institute of Neurology,London, UK
Journal: Scientific reports, volume 16, issue 1, article 28541
Dates: received 20 June 2025; accepted 31 May 2026; published online 8 June 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41598-026-56387-8 · PMID 42260290 · PMCID PMC13572441 · OpenAlex W4409722271
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: structural MRI / diffusion (modality), human (organism), Alzheimer's / dementia (population), clinical / translational (subfield)
Methods: Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions, Machine learning, Preprocessing, Connectivity, Graphs, fMRI & imaging
Keywords: Excitatory/inhibitory balance, Mild cognitive impairment, Alzheimer’s disease, Resting-state networks, Virtual brain modelling, Graph theory, Computational models, Neurological disorders
MeSH: Alzheimer Disease*, Biomarkers*, Brain*, Cognitive Dysfunction*, Dementia*, Aged, Amyloid beta-Peptides, Female, Humans, Magnetic Resonance Imaging, Male, Neuropsychological Tests (* major topic)
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 85 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repositories

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

Anita-93/TVB_rww_tutorial

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 0aa8af8fa4f1685327f27e97f081a9e3b11e3088, 23 April 2026
Languages: Jupyter (1)
Size: 2 files, 1 script
Software Heritage: not archived
Found in: “Data availability”
Holds: README, 1 notebook
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (1 file), NumPy (1 file), The Virtual Brain (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
2 files

wiki.ebrains.eu/bin/view

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: the link answers
Software Heritage: not checked
Found in: “Data availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 1 script, each with its path and the digest of its content;
  • 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-56387-8.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 17 authors, 8 keywords, 12 MeSH terms, 1 funder, 81 references.

Cite

This paper

Monteverdi, A., Cotta Ramusino, M., Conca, F., Manzon, S., Redolfi, A., Lupi, E., De Grazia, M., Lorenzi, R. M., Gaviraghi, M., Mazzocchi, L., Farina, L. M., Costa, A., Pichiecchio, A., Cappa, S. F., Gandini Wheeler-Kingshott, C. A. M., Palesi, F., & D’Angelo, E. (2026). Alterations in topological and dynamical parameters correlate with disease biomarkers and neuropsychological scores in prodromic stages of dementia. Scientific reports, 16(1), 28541. https://doi.org/10.1038/s41598-026-56387-8

BibTeX

@article{monteverdi2026alterations,
author = {Monteverdi, Anita and Cotta Ramusino, Matteo and Conca, Francesca and Manzon, Sofia and Redolfi, Alberto and Lupi, Eleonora and De Grazia, Marialaura and Lorenzi, Roberta Maria and Gaviraghi, Marta and Mazzocchi, Laura and Farina, Lisa M. and Costa, Alfredo and Pichiecchio, Anna and Cappa, Stefano F. and Gandini Wheeler-Kingshott, Claudia A. M. and Palesi, Fulvia and D’Angelo, Egidio},
title = {{Alterations in topological and dynamical parameters correlate with disease biomarkers and neuropsychological scores in prodromic stages of dementia}},
journal = {Scientific reports},
year = {2026},
month = jun,
volume = {16},
number = {1},
pages = {28541},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-56387-8},
url = {https://doi.org/10.1038/s41598-026-56387-8},
pmid = {42260290},
pmcid = {PMC13572441}
}

RIS

TY - JOUR
AU - Monteverdi, Anita
AU - Cotta Ramusino, Matteo
AU - Conca, Francesca
AU - Manzon, Sofia
AU - Redolfi, Alberto
AU - Lupi, Eleonora
AU - De Grazia, Marialaura
AU - Lorenzi, Roberta Maria
AU - Gaviraghi, Marta
AU - Mazzocchi, Laura
AU - Farina, Lisa M.
AU - Costa, Alfredo
AU - Pichiecchio, Anna
AU - Cappa, Stefano F.
AU - Gandini Wheeler-Kingshott, Claudia A. M.
AU - Palesi, Fulvia
AU - D’Angelo, Egidio
TI - Alterations in topological and dynamical parameters correlate with disease biomarkers and neuropsychological scores in prodromic stages of dementia
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/06/08
VL - 16
IS - 1
SP - 28541
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-56387-8
UR - https://doi.org/10.1038/s41598-026-56387-8
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-56387-8",
"type": "article-journal",
"title": "Alterations in topological and dynamical parameters correlate with disease biomarkers and neuropsychological scores in prodromic stages of dementia",
"container-title": "Scientific reports",
"author": [
{
"family": "Monteverdi",
"given": "Anita"
},
{
"family": "Cotta Ramusino",
"given": "Matteo"
},
{
"family": "Conca",
"given": "Francesca"
},
{
"family": "Manzon",
"given": "Sofia"
},
{
"family": "Redolfi",
"given": "Alberto"
},
{
"family": "Lupi",
"given": "Eleonora"
},
{
"family": "De Grazia",
"given": "Marialaura"
},
{
"family": "Lorenzi",
"given": "Roberta Maria"
},
{
"family": "Gaviraghi",
"given": "Marta"
},
{
"family": "Mazzocchi",
"given": "Laura"
},
{
"family": "Farina",
"given": "Lisa M."
},
{
"family": "Costa",
"given": "Alfredo"
},
{
"family": "Pichiecchio",
"given": "Anna"
},
{
"family": "Cappa",
"given": "Stefano F."
},
{
"family": "Gandini Wheeler-Kingshott",
"given": "Claudia A. M."
},
{
"family": "Palesi",
"given": "Fulvia"
},
{
"family": "D’Angelo",
"given": "Egidio"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "28541",
"DOI": "10.1038/s41598-026-56387-8",
"PMID": "42260290",
"PMCID": "PMC13572441",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-56387-8",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
8
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1371/journal.pdig.0001445 [code]
A digital twin approach for simultaneous reconstruction of brain anatomy and dynamics from neural data.
Journal: PLOS digital health
In common: 7 references
[2] doi:10.1038/s41593-026-02205-3 [code]
Competitive interactions shape mammalian brain network dynamics and computation.
Journal: Nature neuroscience
In common: Matplotlib, NumPy, 5 references
[3] doi:10.1038/s43856-026-01707-2 [code]
Decreased amyloid-related structure-function coupling in preclinical Alzheimer's disease.
Journal: Communications medicine
In common: Matplotlib, NumPy, Alzheimer's / dementia, clinical / translational, 5 references
[4] doi:10.1162/imag.a.1147 [code]
The Virtual Brain links transcranial magnetic stimulation evoked potentials and inhibitory neurotransmitter changes in major depressive disorder.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: The Virtual Brain, Matplotlib, NumPy, 2 references
[5] doi:10.7554/elife.108109 [code]
Multimodal MRI marker of cognition explains the association between cognition and mental health in the UK Biobank.
Journal: eLife
In common: Matplotlib, NumPy, structural MRI / diffusion, 5 references
[6] doi:10.1162/netn.a.543 [code]
High-resolution Bayesian Virtual Epileptic Patient using neural field models.
Journal: Network neuroscience (Cambridge, Mass.)
In common: The Virtual Brain, Matplotlib, NumPy, 2 references
[7] doi:10.1177/11795972251404254 [code]
Blind Identification of Altered Functional Subnetworks in Alzheimer's Disease Using Resting-State fMRI.
Journal: Biomedical engineering and computational biology
In common: Alzheimer's / dementia, 4 references
[8] doi:10.1371/journal.pbio.3003916 [code]
Arousal-driven critical roaming reproduces human functional connectivity dynamics.
Journal: PLoS biology
In common: Matplotlib, NumPy, 3 references
[9] doi:10.1162/imag.a.1252 [code]
Does the brain's E:I balance really shape long-range temporal correlations? Lessons learned from 3T MRI.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: Matplotlib, NumPy, structural MRI / diffusion, 3 references
[10] doi:10.1371/journal.pcbi.1013463 [code]
A multi-frequency whole-brain neural mass model with homeostatic feedback inhibition.
Journal: PLoS computational biology
In common: Matplotlib, NumPy, 3 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.