OSCR

Inter-brain functional connectivity: Are we measuring the right thing?

Code ↔ Paper

2 matches 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 2 matches
  1. [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. [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

  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. #%% ### Imports ###
  4. import numpy as np
  5. import matplotlib.pyplot as plt
  6. from mne_connectivity import spectral_connectivity_time
  7. from fooof import Bands
  8. from neurodsp.sim import sim_powerlaw, sim_oscillation
  9. from neurodsp.sim.utils import modulate_signal
  10. from neurodsp.utils import set_random_seed, create_times
  11. import pickle
  12. #%% ### Simulation Settings ###
  13. # PLV or COH (Choose connectivity method to compute) PLV=0, COH=1
  14. method_index = 0 # PLV=0, COH=1
  15. if method_index == 0:
  16. con_method = ('plv','PLV')
  17. else:
  18. con_method = ('coh', 'COH')
  19. # Other settings
  20. n_seconds = 30 # duration of simulation
  21. fs = 1000 # sampling freq
  22. exp_modulating_sig = 0.5 # exponent for modulating signal
  23. exp_ap_sig = 1.0 # exponent for aperiodic signal
  24. sim = 50 # 50number of simulations
  25. n_samples = n_seconds * fs
  26. times = create_times(n_seconds, fs)
  27. n_cycles = {3:'r', 5:'b', 7:'g', 10:'k'}
  28. # Frequency sweep (defines center frequencies to sweep across)
  29. freq_band = Bands({'alpha': [7, 13]})
  30. mid, low, high = 10, 6, 14
  31. step = 0.1
  32. cfs_P2 = np.arange(low, high+0.1, step)
  33. # print(cfs_P2)
  34. osc_power = [0.01, 0.05, 0.1, 0.15, 0.25, 0.5] # for SNR variations
  35. cf_P1 = [10] # Fixed frequency for P1
  36. # Note: osc_power to assess the effect of SNR variations was implemented based on the following resources:
  37. # https://github.com/OscillationMethods/OscillationMethods/blob/main/07-PowerConfounds.ipynb
  38. # https://pubmed.ncbi.nlm.nih.gov/34268825/
  39. #%% ### Signal Simulation ###
  40. set_random_seed(0)
  41. signals_P1 = {10: {osc: [] for osc in osc_power}} # nested by osc_power
  42. #{10:{0.01:[], 0.05:[], 0.1:[], 0.15:[], 0.25:[], 0.5:[]}}
  43. signals_P2 = {osc: [] for osc in osc_power} # nested by osc_power
  44. #{0.01:[],0.05:[],0.1:[],0.15:[],0.25:[],0.5:[]}
  45. for i in range(sim):
  46. mod = sim_powerlaw(n_seconds, fs, exponent=-exp_modulating_sig, f_range=[0.005, 0.5]) # modulating_signal
  47. ap1 = sim_powerlaw(n_seconds, fs, exponent=-exp_ap_sig) # aperiodic_comp1
  48. ap2 = sim_powerlaw(n_seconds, fs, exponent=-exp_ap_sig) # aperiodic_comp2
  49. wn1 = np.random.randn(n_samples) # white noise1
  50. wn2 = np.random.randn(n_samples) # white noise2
  51. # Create P1 signals
  52. for cf in cf_P1:
  53. for osc in osc_power:
  54. osc1 = sim_oscillation(n_seconds, fs, cf, variance=osc) # Pure oscillation P1, with different osc_power (for SNR)
  55. sig1 = modulate_signal(osc1, mod) + ap1 + (wn1 * 1e0) # Signal P1: Amplitude modulated signal + aperiodic component + white noise
  56. signals_P1[cf][osc].append(sig1)
  57. # Create P2 signals
  58. for osc in osc_power:
  59. sig2s = []
  60. for cf2 in cfs_P2:
  61. osc2 = sim_oscillation(n_seconds, fs, cf2, variance=osc) # Pure oscillation P2, with different osc_power (for SNR)
  62. sig2 = modulate_signal(osc2, mod) + ap2 + (wn2 * 1e0) # Signal P2: Amplitude modulated signal + aperiodic component + white noise
  63. sig2s.append(sig2)
  64. signals_P2[osc].append(sig2s)
  65. # Reorganize P2 signals by freq and power
  66. signals_P2_by_freq = {osc: [] for osc in osc_power}
  67. for osc in osc_power:
  68. for i in range(len(cfs_P2)):
  69. P2sig_freq_sim = []
  70. for j in range(sim):
  71. P2sig_freq_sim.append(signals_P2[osc][j][i])
  72. signals_P2_by_freq[osc].append(P2sig_freq_sim)
  73. signals_P2_by_freq[osc] = np.array(signals_P2_by_freq[osc])
  74. # Convert P1 to arrays
  75. for cf in cf_P1:
  76. for osc in osc_power:
  77. signals_P1[cf][osc] = np.array(signals_P1[cf][osc])
  78. #%% ### Connectivity Calculation ###
  79. # Connectivity function
  80. def conn_calc(signals_P2, signals_P1, sfreq, band, n_cycles=10, method='plv'):
  81. signals = np.stack((signals_P2, signals_P1), axis=1)
  82. freqs = np.arange(band[0], band[1], 0.1)
  83. con = spectral_connectivity_time(
  84. signals, freqs, method=method,
  85. indices=(np.array([0]), np.array([1])),
  86. sfreq=sfreq, padding=1, mode='cwt_morlet',
  87. n_cycles=n_cycles, average=True, verbose='error')#, n_jobs='auto')
  88. # Extract connectivity estimates and return average value
  89. con_estimate = con.get_data()
  90. return np.mean(con_estimate)
  91. # dictionary to store all results (conn_values[cf][band][cycle][freq, snr])
  92. conn_values = {
  93. cf: {
  94. 'alpha': {
  95. cycle: np.zeros((len(cfs_P2), len(osc_power)))
  96. for cycle in n_cycles
  97. }
  98. } for cf in cf_P1
  99. }
  100. # Compute Connectivity
  101. for cf in cf_P1:
  102. f_band = freq_band['alpha']
  103. for cycle in n_cycles:
  104. for p_idx, osc in enumerate(osc_power):
  105. for i in range(len(cfs_P2)):
  106. val = conn_calc(signals_P2_by_freq[osc][i], signals_P1[cf][osc], fs, f_band, n_cycles=cycle, method=con_method[0])
  107. conn_values[cf]['alpha'][cycle][i, p_idx] = val
  108. #%% ### Saving data ###
  109. for_plotting = {
  110. "conn_values": conn_values,
  111. "n_cycles": n_cycles,
  112. "cfs_P2": cfs_P2,
  113. "osc_power": osc_power,
  114. "con_method": con_method,
  115. "sim": sim
  116. }
  117. with open(f"{con_method[0]}_SNR.pkl", "wb") as pickle_file:
  118. pickle.dump(for_plotting, pickle_file)
  119. #%% ### Loading data ###
  120. # import pickle
  121. # method_index = 0 # PLV=0, COH=1
  122. # if method_index == 0:
  123. # con_method = ('plv','PLV')
  124. # else:
  125. # con_method = ('coh', 'COH')
  126. # with open(f"{con_method[0]}_SNR.pkl", "rb") as pickle_file:
  127. # loaded = pickle.load(pickle_file)
  128. # # Access individual variables
  129. # cfs_P2 = loaded["cfs_P2"]
  130. # conn_values = loaded["conn_values"]
  131. # # conf = loaded["conf"]
  132. # n_cycles = loaded["n_cycles"]
  133. #%% ### Plotting ###
  134. import matplotlib.pyplot as plt
  135. import seaborn as sns
  136. import numpy as np
  137. plt.rc('font', family='Helvetica')
  138. sns.set_style("white")
  139. # Plotting Parameters
  140. fig_width_cm = 4
  141. fig_height_cm = 4
  142. dpi = 1200
  143. fontsize = 6
  144. cf = 10
  145. band = 'alpha'
  146. cycle = 5
  147. # To set up ticks
  148. osc_power = [0.01, 0.05, 0.1, 0.15, 0.25, 0.5]
  149. labels_x = [f'{s:.2f}'.lstrip('0') if s < 1 else f'{s:.2f}' for s in osc_power]
  150. labels_x = labels_x[::-1] # flip the order, for plotting purposes
  151. freqs = np.linspace(6, 14, 81) # frequency sweep (reversed)
  152. desired_freqs = np.arange(6, 15, 2)
  153. ytick_pos = [np.argmin(np.abs(freqs - f)) + 1.5 for f in desired_freqs]
  154. # Data for plotting
  155. data = conn_values[cf][band][cycle] # shape (81, 6)
  156. data_T=data.T # to transpose the figure, to make it closer to the original
  157. data_T_flip = data.T[::-1, :]
  158. # Create figure
  159. fig_inches = (fig_width_cm / 2.54, fig_height_cm / 2.54)
  160. fig, ax = plt.subplots(figsize=fig_inches, dpi=dpi)
  161. # Heatmap
  162. sns.heatmap(
  163. data_T_flip,
  164. ax=ax,
  165. cmap='BuPu',
  166. cbar=False,
  167. vmin=0,
  168. vmax=1.0,
  169. linewidths=0.0,
  170. linecolor="white"
  171. )
  172. # Axis Labels and Ticks
  173. ax.set_yticks(np.arange(len(osc_power)) + 0.5)
  174. ax.set_yticklabels(labels_x, fontsize=fontsize)
  175. ax.set_ylabel('SNR', fontsize=fontsize)
  176. ax.set_xticks(ytick_pos)
  177. ax.set_xticklabels(desired_freqs, fontsize=fontsize)
  178. ax.set_xlabel("P2's Frequency (Hz)", fontsize=fontsize)
  179. ax.tick_params(
  180. axis='both',
  181. which='both',
  182. direction='out',
  183. length=3,
  184. width=0.5,
  185. color='black',
  186. bottom=True,
  187. top=False,
  188. left=True,
  189. right=False,
  190. labelsize=fontsize
  191. )
  192. # Rotate y-axis labels
  193. for label in ax.get_yticklabels():
  194. label.set_rotation(0)
  195. # Spines
  196. for spine in ax.spines.values():
  197. spine.set_linewidth(0.5)
  198. spine.set_visible(True)
  199. spine.set_edgecolor('black')
  200. # Title
  201. ax.set_title(f'SNR effect on {con_method[1]}',
  202. fontsize=fontsize, fontweight='bold')
  203. # Save figure
  204. plt.savefig(f'{con_method[0]}_Figure_2_SNR.pdf',
  205. format='pdf', dpi=dpi, bbox_inches='tight')
  206. plt.show()

Figure_2_PLV_COH_Panel_B_SNR.py, no license · at the source

Overview

Authors: Juan Camilo Avendano-Diaz1, Patrick Sothmann1, Riitta Hari1,2, Lauri Parkkonen1
  1. Department of Neuroscience and Biomedical Engineering, Aalto University, Espoo, Finland
  2. Department of Art and Media, Aalto University, Espoo, Finland
Institutions: Aalto University (Finland)
Journal: PloS one, volume 21, issue 7, article e0353371
Dates: received 3 December 2025; accepted 23 June 2026; published online 14 July 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1371/journal.pone.0353371 · PMID 42447111 · PMCID PMC13367725 · OpenAlex W4411990437
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), MEG (modality), human (organism)
Methods: Spectral & time-frequency, Connectivity
MeSH: Brain*, Nerve Net*, Brain Mapping, Electroencephalography, Humans, Magnetoencephalography (* major topic)
Journal subjects: Biology and Life Sciences, Neuroscience, Brain Mapping, Magnetoencephalography, Research and Analysis Methods, Imaging Techniques, Neuroimaging, Bioassays and Physiological Analysis, Electrophysiological Techniques, Brain Electrophysiology, Electroencephalography, Physiology, Electrophysiology, Neurophysiology, Medicine and Health Sciences, Clinical Medicine, Clinical Neurophysiology, Engineering and Technology, Signal Processing, Signal to Noise Ratio, Cognitive Science, Physical Sciences, Mathematics, Probability Theory, Probability Distribution, Normal Distribution, White Noise, Respiratory Physiology
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Business Finland (Grant “DIGIMIND” 7981/31/2022); Norman Loveless Memorial Fund
Citations: not cited yet (Europe PMC); 45 references in the paper

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/EEG hyperscanning studies often estimate inter-brain functional connectivity using phase-based metrics applied to oscillatory brain signals, assuming matching peak frequencies between the individuals studied. However, in reality peak frequencies typically differ between subjects and even between brain regions. Using simulated MEG/EEG signals, we systematically assessed how inter-individual frequency differences affect commonly used connectivity measures. Phase-based metrics were highly sensitive to frequency differences across individuals, whereas amplitude envelope correlation remained comparatively stable under these conditions. Our results underscore the need for connectivity metrics specifically tailored for inter-brain analyses. These findings are relevant to a range of disciplines that are increasingly integrating hyperscanning into their methodological toolkits.

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

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: Python (25)
Size: 25 files, 25 scripts
Software Heritage: not checked
Found in: “Data Availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (25 files), NumPy (25 files), MNE-Connectivity (23 files), NeuroDSP (23 files), specparam (formerly FOOOF) (23 files), MNE-Python (21 files), seaborn (2 files), SciPy (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
25 files

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://doi.org/10.17605/OSF.IO/4CD2R.

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://doi.org/10.1371/journal.pone.0353371

BibTeX

@article{avendanodiaz2026inter,
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/journal.pone.0353371},
url = {https://doi.org/10.1371/journal.pone.0353371},
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/07/14
VL - 21
IS - 7
SP - e0353371
SN - 1932-6203
PB - PLOS
DO - 10.1371/journal.pone.0353371
UR - https://doi.org/10.1371/journal.pone.0353371
LA - en
ER -

CSL-JSON

{
"id": "10.1371/journal.pone.0353371",
"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": "PLoS One",
"volume": "21",
"issue": "7",
"page": "e0353371",
"DOI": "10.1371/journal.pone.0353371",
"PMID": "42447111",
"PMCID": "PMC13367725",
"ISSN": "1932-6203",
"publisher": "PLOS",
"URL": "https://doi.org/10.1371/journal.pone.0353371",
"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.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
[2] doi:10.3389/fncom.2026.1786996 [code]
Schumann-anchored golden ratio organization of human neural oscillations.
Journal: Frontiers in computational neuroscience
In common: MNE-Connectivity, specparam (formerly FOOOF), MNE-Python, 4 other tools, EEG, 3 references
[3] doi:10.7554/elife.100605 [code]
Age-related changes in ‘cortical’ 1/f dynamics are linked to cardiac activity
Journal: n/a
In common: NeuroDSP, specparam (formerly FOOOF), MNE-Python, 4 other tools, MEG, 2 references
[4] 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
[5] doi:10.1111/ejn.70255 [code]
A Systematic Review of Aperiodic Neural Activity in Clinical Investigations
Journal: n/a
In common: NeuroDSP, specparam (formerly FOOOF), seaborn, 2 other tools, EEG, 3 references
[6] 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
[7] doi:10.1097/j.pain.0000000000004044 [code]
No effect of rhythmic visual stimulation on experimental pain perception.
Journal: Pain
In common: MNE-Connectivity, specparam (formerly FOOOF), MNE-Python, 4 other tools, EEG, 1 reference
[8] doi:10.1093/nc/niag029 [code]
A data-driven approach to identifying and evaluating connectivity-based neural correlates of conscious visual perception.
Journal: Neuroscience of consciousness
In common: MNE-Connectivity, MNE-Python, seaborn, 3 other tools, MEG, 2 references
[9] doi:10.1162/imag.a.1269 [code]
From early to contemporary normative modeling: Mapping individual differences in neurophysiological signals.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: specparam (formerly FOOOF), MNE-Python, seaborn, 3 other tools, MEG, EEG, 1 reference
[10] doi:10.1038/s42003-026-10394-7 [code]
Cognitive load weakens neural speech tracking without altering response timing.
Journal: Communications biology
In common: MNE-Connectivity, MNE-Python, seaborn, 3 other tools, EEG, 2 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.