Spatially structured heterogeneity shapes large-scale cortical dynamics in a model of the human cortex.
The 4 matches
- [1] § Materials and Methods › Cholinergic Muscarinic Regional Heterogeneity. ↔ HeterogeneousWBrainSimulations.ipynb, lines 19–62 · score 0.85 · probe selection, robust sigmoid, ABAGEN toolbox, mirrored, Gene, subtypes
- [2] § Results › Framework Overview. ↔ HeterogeneousWBrainSimulations.ipynb, lines 19–62 · score 0.68 · Desikan Killiany, ABAGEN toolbox, adaptation parameter, atlas, Gene, subtypes
- [3] § Materials and Methods › Computational Simulations. ↔ HeterogeneousWBrainSimulations.ipynb, lines 383–451 · score 0.56 · duration, Heun, stochastic, transients, stimulation, simulations
- [4] § Materials and Methods › Data Analysis. ↔ TE.py, lines 12–114 · score 0.51 · TE implementation, history, uncertainty, delay, entropy
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 · 597 lines · 19 KB · no license · 3 matches
- # %% [markdown]
- # ### This notebook aims to introduce the MF-Adex framework used in our publication.
- #
- # If you use this code, please cite:
- # Dalla Porta, L. (2026). Spatially structured heterogeneity shapes large-scale cortical dynamics in a model of the human cortex. PNAS, 2026
- #
- # Contact: [email hidden]
- # %%
- import matplotlib.pylab as plt
- import numpy as np
- import pickle
- from tvb.simulator.lab import *
- from tvb.datatypes.connectivity import Connectivity
- import os
- # %% [markdown]
- # ### I. Load receptors map & normalize
- # #### In the paper I used the abagen toolbox following the procedure described in Deco et al. 2011 (https://doi.org/10.1126/sciadv.abf4752)
- #
- # The original values used in the paper are extracted using the abagen toolbox (https://abagen.readthedocs.io/en/stable/) and are commented below.
- # For illustration in this notebok I will use random values.
- # %%
- # Do it only once and save the ACH_clean for future use
- # import abagen
- # import pandas as pd
- # import numpy as np
- # from abagen import images
- # files = abagen.fetch_microarray(donors='all', data_dir = 'C:\\Users\\Leonardo\\abagen-data\\microarray\\')
- # atlas = abagen.fetch_desikan_killiany()
- # expression = abagen.get_expression_data(atlas['image'], gene_norm='robust_sigmoid', probe_selection='rnaseq')
- # # Define the gene names, here muscarinic subtype 1 (CHRM1) and subtype 2 (CHRM2) were used
- # ACH = expression['CHRM1'] + expression['CHRM2']
- # # As in Deco et al. 2011, we use only the left hemisphere as it has more samples. We mirror it to the right hems.
- # # Make sure to have only Desikan-killiany Cortex regions, labelled accordingly.
- # ACH_clean = np.zeros(68)
- # ACH_clean[0:34] = ACH[0:34]
- # ACH_clean[34:68] = ACH[0:34] # mirror the left side to right side
- # # NORMALIZE between 0 and 1
- # max_recp = ACH_clean.max()
- # min_recp = ACH_clean.min()
- # for i in range(len(ACH_clean)):
- # ACH_clean[i] = (ACH_clean[i] - min_recp) / (max_recp - min_recp)
- # ACH_clean = 1-ACH_clean # invert sign so that the higher the expression, the lower b (the adaptation parameter)
- # # Center the distribution around 1, so that it can be more comparable to the homogenous case
- # median_ACH = 1 - np.median(ACH_clean)
- # for i in range(len(ACH_clean)):
- # ACH_clean[i] = ACH_clean[i] + median_ACH
- # ACH_clean is now the normalized muscarinic acetylcholine (CHRM1+CHRM2) density that will be used to modulate the adaptation strenght (b) in the model
- # For the purpose of this example I will use a normal distribution of values
- ACH_clean = np.random.normal(loc=1, scale=0.1, size=68)
- # %% [markdown]
- # ### II. Define the structure connectivity (SC) following The Virtual Brain (TVB) guidelines
- # #### In the paper a specific SC was used (see details in the paper).
- # For the sake of illustration, I will use the cocomac dataset. Download it here: https://zenodo.org/records/14992335
- # %%
- # If you have your own zip file organized as described in TVB, just do:
- # path_connectivity = "C://///"
- # conn = connectivity.Connectivity.from_file(
- # os.path.abspath(path_connectivity + "Connectivity.zip"),
- # )
- # conn.weights = conn.weights/(np.sum(conn.weights,axis=0)+1e-12)
- # conn.speed = np.r_[4.0]
- # As example, let's use the cocomac that we just dowloaded
- conn = connectivity.Connectivity.from_file("tvb_data/tvb_data/connectivity/connectivity_68.zip")
- conn.weights = conn.weights/(np.sum(conn.weights,axis=0)+1e-12)
- conn.speed = np.r_[4.0]
- conn.configure()
- # Visualize
- plt.figure()
- plt.title("Cocomac SC 68 regions")
- plt.xlabel("ROIs")
- plt.ylabel("ROIs")
- im = plt.imshow(conn.weights)
- cbar = plt.colorbar(im)
- cbar.set_label("Weights")
- plt.show()
- # %% [markdown]
- # ### III. Define the dynamic model and its parameters
- # #### We use de AdEx Mean-Field Model (TVB implementation) with the given parameters
- # Pay attention to the b_e variable, it is where the heterogeneity through ACH_clean is introduced following the Eq. described in the paper
- # Shortly, if heterog_fac = 0 we have the homogenous case, and heterog_fac = 1 we have the fully heterogenous case. The strenght of adaptation is regulated by adaptation_ACh variable.
- # %%
- heterog_fac = 1 # between 0 and 1, set the level of heterogeneity
- adaptation_ACh = 30 # it is the amount of adaptation dependent on the heterogeneity factor
- # Notice a constant value of 10 in the b_e; it sets the baseline adaptation.
- adex = models.ZerlautAdaptationSecondOrder(
- g_L = np.r_[10.0],
- E_L_e = np.r_[-64.0],
- E_L_i = np.r_[-65.0],
- C_m = np.r_[200.0],
- b_e = (10 + ACH_clean*(heterog_fac*adaptation_ACh) + (adaptation_ACh*(1-heterog_fac))),
- a_e = np.r_[0.0],
- b_i = np.r_[0.0],
- a_i = np.r_[0.0],
- tau_w_e = np.r_[500.0],
- tau_w_i = np.r_[1.0],
- E_e = np.r_[0.0],
- E_i = np.r_[-80.0],
- Q_e = np.r_[1.5],
- Q_i = np.r_[5.0],
- tau_e = np.r_[5.0],
- tau_i = np.r_[5.0],
- N_tot = np.r_[10000],
- p_connect_e = np.r_[0.05],
- p_connect_i = np.r_[0.05],
- g = np.r_[0.2],
- T = np.r_[20.0],
- P_e = np.r_[
- [
- -0.05017034,
- 0.00451531,
- -0.00794377,
- -0.00208418,
- -0.00054697,
- 0.00341614,
- -0.01156433,
- 0.00194753,
- 0.00274079,
- -0.01066769,
- ]
- ],
- P_i = np.r_[
- [
- -0.05184978,
- 0.0061593,
- -0.01403522,
- 0.00166511,
- -0.0020559,
- 0.00318432,
- -0.03112775,
- 0.00656668,
- 0.00171829,
- -0.04516385,
- ]
- ],
- external_input_ex_ex = np.r_[0.315 * 1e-3],
- external_input_ex_in = np.r_[0.000],
- external_input_in_ex = np.r_[0.315 * 1e-3],
- external_input_in_in = np.r_[0.000],
- K_ext_e = np.r_[400],
- K_ext_i = np.r_[0],
- tau_OU = np.r_[2.0],
- weight_noise = np.r_[2e-4], #1e-4
- )
- adex.variables_of_interest = ['E', 'I', 'C_ee', 'C_ei', 'C_ii', 'W_e', 'W_i', 'ou_drift']
- adex.state_variable_range["E"] = [0.000, 0.000]
- adex.state_variable_range["I"] = [0.00, 0.00]
- adex.state_variable_range["C_ee"] = [0.0, 0.0]
- adex.state_variable_range["C_ei"] = [0.0, 0.0]
- adex.state_variable_range["C_ii"] = [0.0, 0.0]
- adex.state_variable_range["W_e"] = [100., 100.0] # 100?
- adex.state_variable_range["W_i"] = [0.0, 0.0]
- adex.state_variable_range["ou_drift"] = [0.0, 0.0]
- # %%
- # For each region, the value of adaptation is:
- if heterog_fac:
- print("You have choosen an Heterogenous case!\n")
- else:
- print("You have choosen an Homogeneous case\n")
- print(f"Your mean adaptation value should be approximately: {10+adaptation_ACh}")
- print("The adaptation values for each ROI:")
- print(adex.b_e)
- print(f"The real mean is: {np.mean(adex.b_e)}")
- # %% [markdown]
- # ### IVa. Set the simulator
- # %%
- sim = simulator.Simulator(
- model=adex,
- connectivity=conn,
- conduction_speed=conn.speed.item(),
- coupling=coupling.Linear(a = np.r_[0.3], b = np.r_[.0]),
- integrator=integrators.HeunStochastic(
- noise = noise.Additive(nsig=np.r_[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], noise_seed = 1234567), #variables ['E', 'I', 'C_ee', 'C_ei', 'C_ii', 'W_e', 'W_i', 'ou_drift']
- dt = 0.1,
- ),
- monitors=[monitors.TemporalAverage(period=1.0)],
- ).configure()
- # %% [markdown]
- # ### IVb. Run the simulation
- # %%
- transient = 2000 # times are in ms
- time_simulation = 6000
- (out_t, out_d),= sim.run(simulation_length = time_simulation + transient)
- # cut transient
- out_d = out_d[transient:,:,:,:]
- out_t = out_t[transient:]
- # store data
- data_ = {}
- data_["Time"] = out_t*0.001
- data_["TimeSeries_chs"] = out_d[:,0,:,0]*1e3
- # %% [markdown]
- # ### V. Analysis
- # %% [markdown]
- # #### Functional connectivity (Pearson Correlation)
- # %%
- FC = np.corrcoef(np.transpose(data_["TimeSeries_chs"][3800:,:]))
- FC_aux = FC.copy()
- np.fill_diagonal(FC_aux, 0.0)
- iu = np.triu_indices_from(FC_aux, k=1) # Upper diagonal only
- mean_FC = np.nanmean(FC_aux[iu])
- print(f"The <FC> is {mean_FC}")
- fig, axs = plt.subplots(ncols=2)
- im1 = axs[0].imshow(conn.weights, cmap = 'RdBu_r', vmin = 0, vmax = 0.5)
- im2 = axs[1].imshow(FC, cmap = "RdBu_r", vmin = -0.5, vmax = 1)
- axs[0].set_title("Structural Connectivity")
- axs[1].set_title("Functional Connectivity")
- axs[0].set_ylabel("ROIs")
- axs[0].set_xlabel("ROIs")
- axs[1].set_xlabel("ROIs")
- fig.colorbar(im1, ax=axs[0],fraction=0.046, pad=0.04)
- fig.colorbar(im2, ax=axs[1], fraction=0.046, pad=0.04)
- plt.tight_layout()
- plt.show()
- # %% [markdown]
- # #### Structure-Function coupling
- #
- # See paper for details. See also Baum et al 2019 (https://www.pnas.org/doi/10.1073/pnas.1912034117) and Fotiadis et al 2024 (https://www.nature.com/articles/s41583-024-00846-6)
- # %%
- from netneurotools import metrics # Communicability is already implemented, see documentation (https://netneurotools.readthedocs.io/en/latest/)
- from scipy.stats import spearmanr
- Q = metrics.communicability_wei(conn.weights)
- # compute nodwise spearman(FC,Communicability)
- n = Q.shape[0]
- c = np.full(n, np.nan)
- for ii in range(n):
- x = Q[ii, :]
- y = FC_aux[ii, :]
- m = np.isfinite(x) & np.isfinite(y)
- m[ii] = False
- c[ii] = spearmanr(x[m], y[m]).correlation
- print(f"The correlation between structural connectiivyt and functional dynamic patterns is {np.nanmean(c)}")
- # %% [markdown]
- # #### Power Spectral Density (PSD)
- # %%
- from scipy.signal import welch
- i,j=8,0
- dt = data_["Time"][1]-data_["Time"][0]
- fs = 1./dt
- aux_nfft = 3
- aux_nperseg = 1
- sig = data_["TimeSeries_chs"][:,4]
- f, S = welch(sig, fs, nfft = aux_nfft*fs, nperseg = aux_nperseg * fs)
- plt.figure()
- plt.loglog(f, S, lw = 2)
- plt.xlabel("Frequency (Hz)", fontsize = 14)
- plt.ylabel("PSD", fontsize = 14)
- plt.gca().spines['right'].set_visible(False)
- plt.gca().spines['top'].set_visible(False)
- plt.show()
- # %% [markdown]
- # #### Phase-Lag Index (PLI)
- # See paper for details. See also Stam et al. 2007 (https://doi.org/10.1002/hbm.20346)
- # %%
- from scipy.signal import hilbert
- def compute_phase(signal):
- return np.angle(hilbert(signal))
- data2use = data_["TimeSeries_chs"][3800:,:]
- time_len,n_nodes = np.shape(data2use)
- matrix_phase = np.zeros((n_nodes,time_len))
- PLI_matrix = np.zeros((n_nodes,n_nodes))
- # Create phase Matrix
- for i in range(n_nodes):
- matrix_phase[:][i] = compute_phase(data2use[:,i])
- for i in range(n_nodes):
- for j in range(i, n_nodes):
- phase_diff = matrix_phase[i] - matrix_phase[j]
- PLI_aux = np.abs(np.mean(np.sign(phase_diff)))
- PLI_matrix[i, j] = PLI_matrix[j, i] = PLI_aux
- np.fill_diagonal(PLI_matrix, np.nan)
- meanPLI = np.nanmean(PLI_matrix)
- print(f"The mean PLI across all ROIs is {meanPLI}")
- # %% [markdown]
- # #### Correlations between delta power vs adaptation levels/in-degree connectivity
- # %%
- # compute PSD for each region
- dt = data_["Time"][1]-data_["Time"][0]
- fs = 1./dt
- f = {}
- S = {}
- aux_nfft = 10
- aux_nperseg = 1
- for i in range(np.shape(data_["TimeSeries_chs"])[1]):
- sig = data_["TimeSeries_chs"][:,i]
- f[i], S[i] = welch(sig, fs, nfft = aux_nfft*fs, nperseg = aux_nperseg * fs)
- # Filter delta band power
- idx_delta = np.where((f[0]>0.5)&(f[0]<3))
- # Extract delta power for each ROI
- delta_power = np.zeros(np.shape(data_["TimeSeries_chs"])[1])
- for i in range(np.shape(data_["TimeSeries_chs"])[1]):
- delta_power[i] = np.mean(S[i][idx_delta])
- # Extract in-degree connectivity weights for each ROI
- weights_incoming = np.zeros(68)
- for i in range(np.shape(data_["TimeSeries_chs"])[1]):
- weights_incoming[i] = np.mean(conn.weights[i,:])
- # %%
- fig, axs = plt.subplots(ncols=3,figsize=(12,4))
- im = axs[0].imshow(data_["TimeSeries_chs"][3000:5000,:].T,aspect="auto",cmap="inferno")
- cbar = plt.colorbar(im)
- cbar.set_label("Firing rate (Hz)")
- axs[0].set_xlabel("Time")
- axs[0].set_ylabel("ROIs")
- axs[1].scatter(np.log(delta_power),np.log(ACH_clean), c = "gray")
- axs[1].set_ylabel("Log(Adaptation Level)")
- axs[1].set_xlabel("Log(DeltaPower)")
- axs[2].set_ylabel("Adaptation Level")
- axs[2].scatter(np.log(delta_power),np.log(weights_incoming), c = "gray")
- axs[2].set_ylabel("Log(<In-degree>)")
- axs[2].set_xlabel("Log(DeltaPower)")
- plt.tight_layout()
- plt.show()
- # %% [markdown]
- # ### VI. Evoked activity and Transfer Entropy
- #
- # As described in the manuscript, to compute (TE) we briefly stimulated a single cortical area and computed TE between the stimulated region and all other areas.
- # The TE implementation was borrowed from https://github.com/notsebastiano/transfer_entropy
- # %%
- # First, we will need to modify the simulator to account for a stimuli
- nnodes = len(conn.region_labels)
- weight = list(np.zeros(nnodes)) # the stimuli strength, initialized to zero
- weight[27] = 1e-4 # defined the strength of stimuli and which region will receive it
- parameter_stimulus = {
- 'onset': 99.0,
- "tau": 9.0,
- "T": 99.0,
- "weights": None,
- "variables":[0]
- }
- parameter_stimulus['onset']= 3000 #onset time of the stimulus [ms]
- parameter_stimulus["tau"]= 30 # stimulus duration [ms]
- parameter_stimulus["T"]= 1e9 #interstimulus interval [ms]
- parameter_stimulus["weights"]= weight
- parameter_stimulus["variables"]=[0] #variable to kick; 0 excitatory, 1 inhibitory, 2 std excitatory, 3 covariation of ex and in, 4 std inhibitory,
- #5 adaptation excitatory, 6 adaptation inhibitory
- adex.stvar = parameter_stimulus['variables']
- stim_time = parameter_stimulus['onset']
- stim_steps = stim_time*10 #number of steps until stimulus
- eqn_t = equations.PulseTrain()
- eqn_t.parameters["onset"] = np.array(parameter_stimulus["onset"]) # ms
- eqn_t.parameters["tau"] = np.array(parameter_stimulus["tau"]) # ms
- eqn_t.parameters["T"] = np.array(parameter_stimulus["T"]) # ms; # 0.02kHz repetition frequency
- # Set the stimulation
- stimulation = patterns.StimuliRegion(temporal = eqn_t,
- connectivity = conn,
- weight=np.array(parameter_stimulus['weights']))
- # Introduce the stimulus in the Simulator setup
- sim = simulator.Simulator(
- model=adex,
- connectivity=conn,
- conduction_speed=conn.speed.item(),
- coupling=coupling.Linear(a = np.r_[0.3], b = np.r_[.0]),
- integrator=integrators.HeunStochastic(
- noise = noise.Additive(nsig=np.r_[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], noise_seed = 1234567), #variables ['E', 'I', 'C_ee', 'C_ei', 'C_ii', 'W_e', 'W_i', 'ou_drift']
- dt = 0.1,
- ),
- monitors=[monitors.TemporalAverage(period=1.0)],
- stimulus = stimulation, # HERE
- ).configure()
- # Run the model again
- transient = 2000 # times are in ms
- time_simulation = 6000
- (out_t, out_d),= sim.run(simulation_length = time_simulation + transient)
- # cut transient
- out_d = out_d[transient:,:,:,:]
- out_t = out_t[transient:]
- # store data
- data_ = {}
- data_["Time"] = out_t*0.001
- data_["TimeSeries_chs"] = out_d[:,0,:,0]*1e3
- # %% [markdown]
- # #### Compute TE
- #
- # Notice that in the example stimuli is applied at 3000ms, and later we discard the first 2000ms. Therefore the stimuli should be centered in 1000ms.
- # %%
- from TE import transfer_entropy # from https://github.com/notsebastiano/transfer_entropy
- id1 = 27 # ID stim
- inter_i = 1001 # start period
- inter_f = 1401 # end period
- TF_values = []
- for id2 in range(68):
- X = data_["TimeSeries_chs"][inter_i:inter_f,id1]
- Y = data_["TimeSeries_chs"][inter_i:inter_f,id2]
- TE_YX = transfer_entropy(X, Y, delay=5)
- TF_values.append(TE_YX)
- TF_values[id1] = np.nan
- print(f"The mean TE from source to all brain regions is {np.nanmean(TF_values)}")
- # %% [markdown]
- # ### VII. Extras
- # %% [markdown]
- # To compute the correlation between receptor maps spin test was perfomed using the Enigma toolbox (https://enigma-toolbox.readthedocs.io/en/latest/index.html)
- # %%
- # from scipy.stats import spearmanr, pearsonr
- # from enigmatoolbox.permutation_testing import spin_test
- # data_1 = np.random.rand(68)
- # data_2 = np.random.rand(68)
- # # Observed correlation
- # rho_obs, _ = pearsonr(data_1, data_1)
- # # Spin test (use ENIGMA's built-in DK68 surface parcellation)
- # p_spin = spin_test(
- # data_1,
- # data_2,
- # surface_name='fsa5',
- # parcellation_name='aparc',
- # n_rot=10000,
- # type='pearson', # IMPORTANT: match your correlation
- # null_dist=False,
- # ventricles=False
- # )
- # print(f"Observed rho = {rho_obs:.3f}")
- # print(f"Spin-test p = {p_spin:.6f}")
- # %% [markdown]
- # To compute the spin rotated maps brainspace was used: https://brainspace.readthedocs.io/en/latest/
- # %%
- # import numpy as np
- # import nibabel.freesurfer.io as fsio
- # from brainspace.null_models import SpinPermutations
- # FS_HOME = "/Applications/freesurfer/8.0.0"
- # N_PERM = 1000 # how many spin rotated maps will be generated
- # SEED = 42
- # # spheres (fsaverage5)
- # sphere_lh, _ = fsio.read_geometry(f"{FS_HOME}/subjects/fsaverage5/surf/lh.sphere")
- # sphere_rh, _ = fsio.read_geometry(f"{FS_HOME}/subjects/fsaverage5/surf/rh.sphere")
- # # annotations
- # labels_lh, _, names_lh_raw = fsio.read_annot("lh.aparc_fsaverage5.annot")
- # labels_rh, _, names_rh_raw = fsio.read_annot("rh.aparc_fsaverage5.annot")
- # labels_lh = labels_lh.astype(int)
- # labels_rh = labels_rh.astype(int)
- # names_lh = [n.decode("utf-8") if isinstance(n, bytes) else str(n) for n in names_lh_raw]
- # names_rh = [n.decode("utf-8") if isinstance(n, bytes) else str(n) for n in names_rh_raw]
- # # pick cortical parcel IDs: all labels except "unknown" and "corpuscallosum"
- # EXCLUDE = {"unknown", "corpuscallosum"}
- # lh_ids = [i for i, n in enumerate(names_lh) if n not in EXCLUDE]
- # rh_ids = [i for i, n in enumerate(names_rh) if n not in EXCLUDE]
- # # Keep only parcel IDs that actually appear in the vertex labels (avoids empty slices)
- # lh_ids = [i for i in lh_ids if np.any(labels_lh == i)]
- # rh_ids = [i for i in rh_ids if np.any(labels_rh == i)]
- # lh_ids = lh_ids[:34]
- # rh_ids = rh_ids[:34]
- # parcel_names = [names_lh[i] for i in lh_ids] + [names_rh[i] for i in rh_ids]
- # # fit spins
- # sp = SpinPermutations(n_rep=N_PERM, random_state=SEED)
- # sp.fit(sphere_lh, sphere_rh)
- # # load RNA data
- # chrm = ACH_clean
- # # build vertex maps (per hemisphere)
- # vmap_lh = np.zeros(labels_lh.shape, dtype=float)
- # vmap_rh = np.zeros(labels_rh.shape, dtype=float)
- # for j, pid in enumerate(lh_ids):
- # vmap_lh[labels_lh == pid] = chrm[j]
- # for j, pid in enumerate(rh_ids):
- # vmap_rh[labels_rh == pid] = chrm[34 + j]
- # # spin-randomize
- # vmap_spins_lh, vmap_spins_rh = sp.randomize(vmap_lh, vmap_rh)
- # # average back to DK68
- # sp_maps = np.zeros((N_PERM, 68), dtype=float)
- # for i in range(N_PERM):
- # for j, pid in enumerate(lh_ids):
- # sp_maps[i, j] = vmap_spins_lh[i][labels_lh == pid].mean()
- # for j, pid in enumerate(rh_ids):
- # sp_maps[i, 34 + j] = vmap_spins_rh[i][labels_rh == pid].mean()
- # # Spin rotated maps are stored in sp_maps
- # %% [markdown]
- # Statistics
- # %%
- # # z-values (z-score)
- # # aligned = mean value of the observable
- # # mu = mean value of the null model
- # # sd = standard deviation of the null model
- # delta = aligned - mu
- # z = delta / sd if sd > 0 else np.nan
- # # Empirical p-value
- # # observed = mean value of the observable. It's a single value
- # # null = distribution of mean values of the null models
- # # z value relative to null
- # null_mean = null.mean()
- # null_std = null.std(ddof=0)
- # # two-sided empirical p value
- # obs_dev = abs(observed - null_mean)
- # null_dev = abs(null - null_mean)
- # p_emp = (np.sum(null_dev >= obs_dev) + 1) / (len(null) + 1)
- # print(f"p_emp = {p_emp:.4g}")
HeterogeneousWBrainSimulations.ipynb at commit d458969, no license · at the source
Overview
- Institute of Biomedical Investigations August Pi i Sunyer, Systems Neuroscience, Barcelona 08036, Spain
- Central European Institute of Technology, Masaryk University, Brno 65691, Czech Republic
- Department for Integrative and Computational Neuroscience, Paris-Saclay University, CNRS, Paris-Saclay Institute of Neuroscience, Saclay 91400, France
- Catalan Institution for Research and Advanced Studies, Barcelona 08010, Spain
Abstract
The human brain displays substantial spatial variability in molecular, anatomical, and physiological organization. Yet, how this heterogeneity shapes large-scale neuronal dynamics remains poorly understood. To address this question, we employed a biologically informed large-scale cortical model capable of generating distinct brain states, from awake-like to sleep-like dynamics. Our model was constrained by empirical human structural connectivity (SC) and regional cholinergic muscarinic receptor (CHRM) maps derived from transcriptomic data, together with complementary positron emission tomography (PET)-based receptor maps. These regional maps were implemented as modulators of adaptation-related excitability. We found that modulating excitability according to the spatial organization of CHRM maps significantly impacted large-scale cortical dynamics: It not only facilitated network synchronization but also enhanced information flow between cortical regions. Importantly, these effects were conserved across transcriptomic and PET-derived maps and could not be fully reproduced by multiple null models preserving generic forms of heterogeneity. Moreover, we addressed a particularly intricate dynamic regime characterized by the coexistence of localized sleep-like activity within otherwise awake-like states. We showed that the emergence of these sleep-like slow waves was a byproduct of both regional levels of neuronal adaptation and SC. In summary, our findings highlight the critical role of molecular and anatomical heterogeneity in shaping widespread cortical dynamics, suggesting broad avenues for linking microscale diversity to macroscale function.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 4 matches between paragraphs and lines of code.
notsebastiano/transfer_entropy
165baefd5621c131aaf07c422bf8cdbf66ca0be2, 28 February 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
4 files
- TE.py, Python, 115 lines, 1 match
- test_TE.ipynb, Jupyter, 163 lines
- LICENSE.txt, License, 21 lines
- README.md, Text, 44 lines
ldallap/HeterogeneousBrainModel
d45896933c6de91b941815625cc012cb688be6d0, 9 July 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
2 files
- HeterogeneousWBrainSimul
ations.ipynb , Jupyter, 597 lines, 3 matches - README.md, Text, 9 lines
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;
- 3 scripts, each with its path and the digest of its content;
- 4 matches 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
No dataset and no data link were found in the paper.
Data, Materials, and Software Availability
The code needed to replicate the main findings of this study has been deposited in Heterogeneous Brain Model (https://
Reproduced under the paper's license (CC BY), from the paper cited above.
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, 4 authors, 5 keywords, 8 MeSH terms, 5 funders, 111 references.
Cite
This paper
Dalla Porta, L., Fousek, J., Destexhe, A., & Sanchez-Vives, M. V. (2026). Spatially structured heterogeneity shapes large-scale cortical dynamics in a model of the human cortex. Proceedings of the National Academy of Sciences of the United States of America, 123(28), e2532072123. https://
BibTeX
@article{dallaporta2026s
author = {Dalla Porta, Leonardo and Fousek, Jan and Destexhe, Alain and Sanchez-Vives, Maria V},
title = {{Spatially structured heterogeneity shapes large-scale cortical dynamics in a model of the human cortex}},
journal = {Proceedings of the National Academy of Sciences of the United States of America},
year = {2026},
month = jul,
volume = {123},
number = {28},
pages = {e2532072123},
publisher = {National Academy of Sciences},
issn = {0027-8424},
doi = {10.1073/
url = {https://
pmid = {42418484},
pmcid = {PMC13367858}
}
RIS
TY - JOUR
AU - Dalla Porta, Leonardo
AU - Fousek, Jan
AU - Destexhe, Alain
AU - Sanchez-Vives, Maria V
TI - Spatially structured heterogeneity shapes large-scale cortical dynamics in a model of the human cortex
T2 - Proceedings of the National Academy of Sciences of the United States of America
J2 - Proc Natl Acad Sci U S A
PY - 2026
DA - 2026/
VL - 123
IS - 28
SP - e2532072123
SN - 0027-8424
PB - National Academy of Sciences
DO - 10.1073/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1073/
"type": "article-journal",
"title": "Spatially structured heterogeneity shapes large-scale cortical dynamics in a model of the human cortex",
"container-title": "Proceedings of the National Academy of Sciences of the United States of America",
"author": [
{
"family": "Dalla Porta",
"given": "Leonardo"
},
{
"family": "Fousek",
"given": "Jan"
},
{
"family": "Destexhe",
"given": "Alain"
},
{
"family": "Sanchez-Vives",
"given": "Maria V"
}
],
"container-title-short":
"volume": "123",
"issue": "28",
"page": "e2532072123",
"DOI": "10.1073/
"PMID": "42418484",
"PMCID": "PMC13367858",
"ISSN": "0027-8424",
"publisher": "National Academy of Sciences",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
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.pbio.3003916 [code]
- Arousal-driven critical roaming reproduces human functional connectivity dynamics.Journal: PLoS biologyIn common: SciPy, Matplotlib, NumPy, 10 references
- [2] doi:10.1371/journal.pcbi.1013463 [code]
- A multi-frequency whole-brain neural mass model with homeostatic feedback inhibition.Journal: PLoS computational biologyIn common: SciPy, Matplotlib, NumPy, 8 references
- [3] doi:10.1186/s12916-026-04903-y [code]
- Structural connectome architecture and biological vulnerability shape cortical atrophy in cocaine use disorder.Journal: BMC medicineIn common: netneurotools, SciPy, Matplotlib, 1 other tool, 7 references
- [4] doi:10.1093/sleepadvances/zpag065 [code]
- Brain-wide properties of slow waves across vigilance states.Journal: Sleep advances : a journal of the Sleep Research SocietyIn common: 8 references
- [5] doi:10.1038/s42003-025-09444-3 [code]
- Decoupling of neurophysiological activity from structure mirrors global microarchitectural and neuromodulatory trends.Journal: Communications biologyIn common: netneurotools, SciPy, Matplotlib, 1 other tool, cellular / molecular, 6 references
- [6] doi:10.1126/sciadv.aef2894 [code]
- Human cortical networks trade communication efficiency for computational reliability.Journal: Science advancesIn common: netneurotools, SciPy, Matplotlib, 1 other tool, 5 references
- [7] doi:10.1016/j.celrep.2026.117782 [code]
- Thermodynamics of consciousness: Non-equilibrium brain dynamics track conscious states.Journal: Cell reportsIn common: SciPy, Matplotlib, NumPy, 6 references
- [8] doi:10.1002/hbm.70605 [code]
- BrainEnrich: Revealing Biological Insights for Imaging-Derived Phenotypes Through Transcriptomic Enrichment.Journal: Human brain mappingIn common: netneurotools, SciPy, Matplotlib, 1 other tool, 6 references
- [9] doi:10.3390/brainsci16080822
- Photopharmacological Cholinergic Modulation of Cortical Activity in Human Brain Slices.Journal: Brain sciencesIn common: 4 references, author Maria V Sanchez-Vives
- [10] doi:10.1371/journal.pcbi.1013252 [code]
- Dynamic cholinergic signaling differentially desynchronizes cortical microcircuits dependent on modulation rate and network connectivity.Journal: PLoS computational biologyIn common: Matplotlib, NumPy, cellular / molecular, 6 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 3 scripts, and 4 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:48caa071e6e6ba87…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
