Inter-brain functional connectivity: Are we measuring the right thing?
The 2 matches
- [1] § Materials and methods ↔ Simulation Codes/Figure_2_PLV_COH_Panel_B_SNR.py, lines 57–78 · score 0.74 · aperiodic component, 0.005–0.5 Hz, amplitude modulated, white noise, 0.005 Hz, SNR
- [2] § Materials and methods ↔ Simulation Codes/Figure_2_AEC_Panel_B_SNR.py, lines 55–76 · score 0.73 · aperiodic component, 0.005–0.5 Hz, amplitude modulated, white noise, 0.005 Hz, SNR
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
Python · 251 lines · 7.4 KB · no license · 1 match
- #!/usr/bin/env python
- # coding: utf-8
- #%% ### Imports ###
- import numpy as np
- import matplotlib.pyplot as plt
- from mne_connectivity import spectral_connectivity_time
- from fooof import Bands
- from neurodsp.sim import sim_powerlaw, sim_oscillation
- from neurodsp.sim.utils import modulate_signal
- from neurodsp.utils import set_random_seed, create_times
- import pickle
- #%% ### Simulation Settings ###
- # PLV or COH (Choose connectivity method to compute) PLV=0, COH=1
- method_index = 0 # PLV=0, COH=1
- if method_index == 0:
- con_method = ('plv','PLV')
- else:
- con_method = ('coh', 'COH')
- # Other settings
- n_seconds = 30 # duration of simulation
- fs = 1000 # sampling freq
- exp_modulating_sig = 0.5 # exponent for modulating signal
- exp_ap_sig = 1.0 # exponent for aperiodic signal
- sim = 50 # 50number of simulations
- n_samples = n_seconds * fs
- times = create_times(n_seconds, fs)
- n_cycles = {3:'r', 5:'b', 7:'g', 10:'k'}
- # Frequency sweep (defines center frequencies to sweep across)
- freq_band = Bands({'alpha': [7, 13]})
- mid, low, high = 10, 6, 14
- step = 0.1
- cfs_P2 = np.arange(low, high+0.1, step)
- # print(cfs_P2)
- osc_power = [0.01, 0.05, 0.1, 0.15, 0.25, 0.5] # for SNR variations
- cf_P1 = [10] # Fixed frequency for P1
- # Note: osc_power to assess the effect of SNR variations was implemented based on the following resources:
- # https://github.com/OscillationMethods/OscillationMethods/blob/main/07-PowerConfounds.ipynb
- # https://pubmed.ncbi.nlm.nih.gov/34268825/
- #%% ### Signal Simulation ###
- set_random_seed(0)
- signals_P1 = {10: {osc: [] for osc in osc_power}} # nested by osc_power
- #{10:{0.01:[], 0.05:[], 0.1:[], 0.15:[], 0.25:[], 0.5:[]}}
- signals_P2 = {osc: [] for osc in osc_power} # nested by osc_power
- #{0.01:[],0.05:[],0.1:[],0.15:[],0.25:[],0.5:[]}
- for i in range(sim):
- mod = sim_powerlaw(n_seconds, fs, exponent=-exp_modulating_sig, f_range=[0.005, 0.5]) # modulating_signal
- ap1 = sim_powerlaw(n_seconds, fs, exponent=-exp_ap_sig) # aperiodic_comp1
- ap2 = sim_powerlaw(n_seconds, fs, exponent=-exp_ap_sig) # aperiodic_comp2
- wn1 = np.random.randn(n_samples) # white noise1
- wn2 = np.random.randn(n_samples) # white noise2
- # Create P1 signals
- for cf in cf_P1:
- for osc in osc_power:
- osc1 = sim_oscillation(n_seconds, fs, cf, variance=osc) # Pure oscillation P1, with different osc_power (for SNR)
- sig1 = modulate_signal(osc1, mod) + ap1 + (wn1 * 1e0) # Signal P1: Amplitude modulated signal + aperiodic component + white noise
- signals_P1[cf][osc].append(sig1)
- # Create P2 signals
- for osc in osc_power:
- sig2s = []
- for cf2 in cfs_P2:
- osc2 = sim_oscillation(n_seconds, fs, cf2, variance=osc) # Pure oscillation P2, with different osc_power (for SNR)
- sig2 = modulate_signal(osc2, mod) + ap2 + (wn2 * 1e0) # Signal P2: Amplitude modulated signal + aperiodic component + white noise
- sig2s.append(sig2)
- signals_P2[osc].append(sig2s)
- # Reorganize P2 signals by freq and power
- signals_P2_by_freq = {osc: [] for osc in osc_power}
- for osc in osc_power:
- for i in range(len(cfs_P2)):
- P2sig_freq_sim = []
- for j in range(sim):
- P2sig_freq_sim.append(signals_P2[osc][j][i])
- signals_P2_by_freq[osc].append(P2sig_freq_sim)
- signals_P2_by_freq[osc] = np.array(signals_P2_by_freq[osc])
- # Convert P1 to arrays
- for cf in cf_P1:
- for osc in osc_power:
- signals_P1[cf][osc] = np.array(signals_P1[cf][osc])
- #%% ### Connectivity Calculation ###
- # Connectivity function
- def conn_calc(signals_P2, signals_P1, sfreq, band, n_cycles=10, method='plv'):
- signals = np.stack((signals_P2, signals_P1), axis=1)
- freqs = np.arange(band[0], band[1], 0.1)
- con = spectral_connectivity_time(
- signals, freqs, method=method,
- indices=(np.array([0]), np.array([1])),
- sfreq=sfreq, padding=1, mode='cwt_morlet',
- n_cycles=n_cycles, average=True, verbose='error')#, n_jobs='auto')
- # Extract connectivity estimates and return average value
- con_estimate = con.get_data()
- return np.mean(con_estimate)
- # dictionary to store all results (conn_values[cf][band][cycle][freq, snr])
- conn_values = {
- cf: {
- 'alpha': {
- cycle: np.zeros((len(cfs_P2), len(osc_power)))
- for cycle in n_cycles
- }
- } for cf in cf_P1
- }
- # Compute Connectivity
- for cf in cf_P1:
- f_band = freq_band['alpha']
- for cycle in n_cycles:
- for p_idx, osc in enumerate(osc_power):
- for i in range(len(cfs_P2)):
- val = conn_calc(signals_P2_by_freq[osc][i], signals_P1[cf][osc], fs, f_band, n_cycles=cycle, method=con_method[0])
- conn_values[cf]['alpha'][cycle][i, p_idx] = val
- #%% ### Saving data ###
- for_plotting = {
- "conn_values": conn_values,
- "n_cycles": n_cycles,
- "cfs_P2": cfs_P2,
- "osc_power": osc_power,
- "con_method": con_method,
- "sim": sim
- }
- with open(f"{con_method[0]}_SNR.pkl", "wb") as pickle_file:
- pickle.dump(for_plotting, pickle_file)
- #%% ### Loading data ###
- # import pickle
- # method_index = 0 # PLV=0, COH=1
- # if method_index == 0:
- # con_method = ('plv','PLV')
- # else:
- # con_method = ('coh', 'COH')
- # with open(f"{con_method[0]}_SNR.pkl", "rb") as pickle_file:
- # loaded = pickle.load(pickle_file)
- # # Access individual variables
- # cfs_P2 = loaded["cfs_P2"]
- # conn_values = loaded["conn_values"]
- # # conf = loaded["conf"]
- # n_cycles = loaded["n_cycles"]
- #%% ### Plotting ###
- import matplotlib.pyplot as plt
- import seaborn as sns
- import numpy as np
- plt.rc('font', family='Helvetica')
- sns.set_style("white")
- # Plotting Parameters
- fig_width_cm = 4
- fig_height_cm = 4
- dpi = 1200
- fontsize = 6
- cf = 10
- band = 'alpha'
- cycle = 5
- # To set up ticks
- osc_power = [0.01, 0.05, 0.1, 0.15, 0.25, 0.5]
- labels_x = [f'{s:.2f}'.lstrip('0') if s < 1 else f'{s:.2f}' for s in osc_power]
- labels_x = labels_x[::-1] # flip the order, for plotting purposes
- freqs = np.linspace(6, 14, 81) # frequency sweep (reversed)
- desired_freqs = np.arange(6, 15, 2)
- ytick_pos = [np.argmin(np.abs(freqs - f)) + 1.5 for f in desired_freqs]
- # Data for plotting
- data = conn_values[cf][band][cycle] # shape (81, 6)
- data_T=data.T # to transpose the figure, to make it closer to the original
- data_T_flip = data.T[::-1, :]
- # Create figure
- fig_inches = (fig_width_cm / 2.54, fig_height_cm / 2.54)
- fig, ax = plt.subplots(figsize=fig_inches, dpi=dpi)
- # Heatmap
- sns.heatmap(
- data_T_flip,
- ax=ax,
- cmap='BuPu',
- cbar=False,
- vmin=0,
- vmax=1.0,
- linewidths=0.0,
- linecolor="white"
- )
- # Axis Labels and Ticks
- ax.set_yticks(np.arange(len(osc_power)) + 0.5)
- ax.set_yticklabels(labels_x, fontsize=fontsize)
- ax.set_ylabel('SNR', fontsize=fontsize)
- ax.set_xticks(ytick_pos)
- ax.set_xticklabels(desired_freqs, fontsize=fontsize)
- ax.set_xlabel("P2's Frequency (Hz)", fontsize=fontsize)
- ax.tick_params(
- axis='both',
- which='both',
- direction='out',
- length=3,
- width=0.5,
- color='black',
- bottom=True,
- top=False,
- left=True,
- right=False,
- labelsize=fontsize
- )
- # Rotate y-axis labels
- for label in ax.get_yticklabels():
- label.set_rotation(0)
- # Spines
- for spine in ax.spines.values():
- spine.set_linewidth(0.5)
- spine.set_visible(True)
- spine.set_edgecolor('black')
- # Title
- ax.set_title(f'SNR effect on {con_method[1]}',
- fontsize=fontsize, fontweight='bold')
- # Save figure
- plt.savefig(f'{con_method[0]}_Figure_2_SNR.pdf',
- format='pdf', dpi=dpi, bbox_inches='tight')
- plt.show()
Figure_2_PLV_COH_Panel_B_SNR.py, no license · at the source
Overview
- Department of Neuroscience and Biomedical Engineering, Aalto University, Espoo, Finland
- Department of Art and Media, Aalto University, Espoo, Finland
Abstract
Hyperscanning—the simultaneous recording of brain activity from multiple individuals—and the study of inter-brain synchronization is gaining popularity in social neuroscience. MEG/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
OSF 4cd2r
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
25 files
- Simulation Codes/
Fig3AB_distributions.py , Python, 231 lines - Simulation Codes/
Fig3CD_AEC_population_co , Python, 159 linesmputation.py - Simulation Codes/
Fig3CD_PLV_AEC_populatio , Python, 90 linesn_plotting.py - Simulation Codes/
Fig3CD_PLV_population_co , Python, 169 linesmputation.py - Simulation Codes/
Figure_2_AEC_Panel_A.py , Python, 195 lines - Simulation Codes/
Figure_2_AEC_Panel_B_SNR , Python, 262 lines, 1 match.py - Simulation Codes/
Figure_2_PLV_COH_Panel_A , Python, 204 lines.py - Simulation Codes/
Figure_2_PLV_COH_Panel_B , Python, 251 lines, 1 match_SNR.py - Simulation Codes/
Supporting Information/ , Python, 207 linesS1_Fig_cf11.py.py - Simulation Codes/
Supporting Information/ , Python, 207 linesS1_Fig_cf13.py.py - Simulation Codes/
Supporting Information/ , Python, 207 linesS1_Fig_cf7.py - Simulation Codes/
Supporting Information/ , Python, 207 linesS1_Fig_cf9.py.py - Simulation Codes/
Supporting Information/ , Python, 209 linesS2_Fig_ciplv_phase45.py - Simulation Codes/
Supporting Information/ , Python, 209 linesS2_Fig_mic_phase45.py - Simulation Codes/
Supporting Information/ , Python, 208 linesS2_Fig_pli_phase45.py - Simulation Codes/
Supporting Information/ , Python, 208 linesS2_Fig_plv_phase45.py - Simulation Codes/
Supporting Information/ , Python, 208 linesS2_Fig_wpli_phase45.py - Simulation Codes/
Supporting Information/ , Python, 208 linesS3_Fig_plv_alpha_8-12.py - Simulation Codes/
Supporting Information/ , Python, 208 linesS3_Fig_plv_alpha_9-11.py - Simulation Codes/
Supporting Information/ , Python, 208 linesS3_Fig_plv_alpha_95-105. py - Simulation Codes/
Supporting Information/ , Python, 212 linesS4_Fig_plv_window10sec.p y - Simulation Codes/
Supporting Information/ , Python, 212 linesS4_Fig_plv_window1sec.py - Simulation Codes/
Supporting Information/ , Python, 212 linesS4_Fig_plv_window3sec.py - Simulation Codes/
Supporting Information/ , Python, 212 linesS4_Fig_plv_window5sec.py - Simulation Codes/
Supporting Information/ , Python, 212 linesS4_Fig_plv_window7sec.py
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:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 25 scripts, each with its path and the digest of its content;
- 2 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 Availability
All relevant data (simulation codes) are available in a permanent repository named “Inter-brain FC”: 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 2, 28 September 2026
- Authors: added Lauri Parkkonen (0000-0002-0130-0801); removed Lauri Parkkonen
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 6 MeSH terms, 2 funders, 42 references.
Cite
This paper
Avendano-Diaz, J. C., Sothmann, P., Hari, R., & Parkkonen, L. (2026). Inter-brain functional connectivity: Are we measuring the right thing? PloS one, 21(7), e0353371. https://
BibTeX
@article{avendanodiaz202
author = {Avendano-Diaz, Juan Camilo and Sothmann, Patrick and Hari, Riitta and Parkkonen, Lauri},
title = {{Inter-brain functional connectivity: Are we measuring the right thing?
journal = {PloS one},
year = {2026},
month = jul,
volume = {21},
number = {7},
pages = {e0353371},
publisher = {PLOS},
issn = {1932-6203},
doi = {10.1371/
url = {https://
pmid = {42447111},
pmcid = {PMC13367725}
}
RIS
TY - JOUR
AU - Avendano-Diaz, Juan Camilo
AU - Sothmann, Patrick
AU - Hari, Riitta
AU - Parkkonen, Lauri
TI - Inter-brain functional connectivity: Are we measuring the right thing?
T2 - PloS one
J2 - PLoS One
PY - 2026
DA - 2026/
VL - 21
IS - 7
SP - e0353371
SN - 1932-6203
PB - PLOS
DO - 10.1371/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1371/
"type": "article-journal",
"title": "Inter-brain functional connectivity: Are we measuring the right thing?
"container-title": "PloS one",
"author": [
{
"family": "Avendano-Diaz",
"given": "Juan Camilo"
},
{
"family": "Sothmann",
"given": "Patrick"
},
{
"family": "Hari",
"given": "Riitta"
},
{
"family": "Parkkonen",
"given": "Lauri"
}
],
"container-title-short":
"volume": "21",
"issue": "7",
"page": "e0353371",
"DOI": "10.1371/
"PMID": "42447111",
"PMCID": "PMC13367725",
"ISSN": "1932-6203",
"publisher": "PLOS",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
14
]
]
}
}
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.1002/hbm.70484 [code]
- Frequency-Resolved Cortical Functional Connectivity Across the Adult Lifespan.Journal: Human brain mappingIn common: MEG, 6 references, 2 authors
- [2] doi:10.1162/imag.a.1245 [code]
- Towards precision EEG connectomics: Evaluating the benefits of dense sampling.Journal: Imaging neuroscience (Cambridge, Mass.)In common: MNE-Connectivity, MNE-Python, seaborn, 3 other tools, EEG, 6 references
- [3] doi:10.3389/fncom.2026.1786996 [code]
- Schumann-anchored golden ratio organization of human neural oscillations.Journal: Frontiers in computational neuroscienceIn common: MNE-Connectivity, specparam (formerly FOOOF), MNE-Python, 4 other tools, EEG, 3 references
- [4] doi:10.7554/elife.100605 [code]
- Age-related changes in ‘cortical’ 1/
f dynamics are linked to cardiac activity Journal: n/aIn common: NeuroDSP, specparam (formerly FOOOF), MNE-Python, 4 other tools, MEG, 2 references - [5] doi:10.1093/cercor/bhag113 [code]
- Long-term reliability and stability of parameterized resting state EEG: evidence from a five-year follow-up.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: NeuroDSP, specparam (formerly FOOOF), MNE-Python, 4 other tools, EEG, 2 references
- [6] doi:10.1111/ejn.70255 [code]
- A Systematic Review of Aperiodic Neural Activity in Clinical InvestigationsJournal: n/aIn common: NeuroDSP, specparam (formerly FOOOF), seaborn, 2 other tools, EEG, 3 references
- [7] doi:10.3390/s26134019 [code]
- NeuroStat: An Open-Source EEG Connectivity Platform for Randomised Controlled Trials.Journal: Sensors (Basel, Switzerland)In common: MNE-Connectivity, MNE-Python, SciPy, 2 other tools, EEG, 4 references
- [8] doi:10.1038/s41467-026-70287-5 [code]
- Cortical-limbic circuit dynamics of approach-avoidance conflict in humans.Journal: Nature communicationsIn common: NeuroDSP, specparam (formerly FOOOF), MNE-Python, 4 other tools, EEG, 1 reference
- [9] doi:10.1097/j.pain.0000000000004044 [code]
- No effect of rhythmic visual stimulation on experimental pain perception.Journal: PainIn common: MNE-Connectivity, specparam (formerly FOOOF), MNE-Python, 4 other tools, EEG, 1 reference
- [10] doi:10.1162/imag.a.1226 [code]
- A neuroscientist's guide to neural burst detection.Journal: Imaging neuroscience (Cambridge, Mass.)In common: NeuroDSP, specparam (formerly FOOOF), MNE-Python, 4 other tools, 1 reference
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: 1 repository of the authors' code, each at its verified commit and with its license, 25 scripts, and 2 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:2fc4c96ade46fa26…
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
[.
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.
