OSCR

Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses.

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 › Simulations › 3. Scaling and Noise ↔ micorr/simulation/testing.py, lines 19–88 · score 0.53 · noise ratio, standard deviation, outlier, transformations, SNR, simulations

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 · 258 lines · 10 KB · GPL-3.0 · 1 match

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Tue Mar 4 12:21:16 2025
  5. @author: anni
  6. """
  7. from . import transformations, simulations
  8. from ..snr import snr_func
  9. from tqdm import tqdm
  10. import numpy as np
  11. import matplotlib.pyplot as plt
  12. import os
  13. import pandas as pd
  14. import pickle
  15. def test_estimators(base_signal1,
  16. base_signal2=None,
  17. scaling_func=simulations.max_scaling,
  18. changes=None,
  19. trans_func=None,
  20. outliers= None,
  21. z_score = [3,5],
  22. estimator_list=None,
  23. compare_with_noise=False,
  24. n_runs=1000,
  25. snr_db=10,
  26. add_noise=[1,1],
  27. base_snr=False):
  28. '''
  29. Test similarity estimatore by applying transformations, adding noise, or adding outliers to a base signal.
  30. Only one of the following can be used per function call:
  31. - trans_function: to ba a transformation to the signal.
  32. - outliers: to add outlier to the signal.
  33. - compare_with_noise: to compare the signal with pure noise.
  34. - `snr_db = None`: to vary the signal-to-noise ratio across runs.
  35. These options are mutually exclusive. If more than one is specified, a ValueError is raised.
  36. Parameters
  37. ----------
  38. base_signal : np.array
  39. A noise free base signal that will be transformed.
  40. scaling_func: callable or None
  41. A function used to scale the signals.
  42. if None no scaling is applied.
  43. By default scaling based on the shared maximum value of the two signals is applied.
  44. changes : list
  45. A list of transformation values to test
  46. (e.g., noise levels, transformation magnitudes, number of outliers).
  47. trans_function : callable or None, optional
  48. A function applied the transform the signal.
  49. The provided function should return both two signals to be compared.
  50. If None no transformation applied. The default is None.
  51. outliers : None or lstr
  52. Whether outliers are added.
  53. If None no outliers are added.
  54. If 'one' outliers are added into base_signal1.
  55. If 'both'outliers are added into both of the signals.
  56. The default is None.
  57. compare_with_noise: bool or int
  58. If a float is provided, the signal is compare with a pure noise signal with that standard deviation.
  59. If False (default) noise comparision is not done.
  60. n_runs : int, optional
  61. Number of iteration to run the simulation. The default is 1000.
  62. snr_db : int, optional
  63. The signal to noise ratio of the simulated signal after the random noise is added.
  64. If None the noise is changed based on the changes parameter.
  65. The default is 10.
  66. add_noise: list, optional
  67. Whether the noise is added into both of the signals or only first of the signals.
  68. One in the list means that the noise will be added into that signal.
  69. base_snr: bool, optional
  70. If True the SNR will de defined based on the given base signal.
  71. If False (default) the transformed signal will be used to define the SNR
  72. Returns
  73. -------
  74. results : dict
  75. A dictionary containing the results of the given similarity estimators
  76. across iterations where random noise is added
  77. while changing the given transformation parameter.
  78. '''
  79. # Ensuring that the user tries to do only one of the options
  80. mode_flags = [
  81. trans_func is not None,
  82. outliers is not None,
  83. compare_with_noise not in [False, None],
  84. snr_db is None]
  85. if sum(mode_flags) > 1:
  86. raise ValueError("Only one of the following can be used at a time: trans_function, outliers, "
  87. "compare_with_noise, or setting snr_db=None.")
  88. # Initializing dictionaries for the estimator results
  89. if changes is not None:
  90. results = {estimator: {} for estimator in estimator_list}
  91. else:
  92. changes = [None]
  93. results = {estimator: [] for estimator in estimator_list}
  94. if base_signal2 is None:
  95. base_signal2 = base_signal1
  96. if base_snr:
  97. before_trans = base_signal1
  98. before_trans_scaled, _ = scaling_func(before_trans, before_trans)
  99. # Tracking the progress of the calculations
  100. n_total = len(changes) * n_runs * len(estimator_list)
  101. with tqdm(total=n_total, desc='Total Progress') as pbar:
  102. # Looping through the different values applied in the transformations
  103. for change in changes:
  104. # transformation applied across the changes
  105. if trans_func:
  106. transformed1, transformed2 = trans_func(base_signal1, change)
  107. else:
  108. transformed1, transformed2 = base_signal1, base_signal2
  109. # Scaling
  110. if scaling_func:
  111. scaled1, scaled2 = scaling_func(transformed1, transformed2)
  112. # Adding random noise in n_runs iterations
  113. for i in range(n_runs):
  114. # When snr_db is spet to None we change the SNR level
  115. snr_aim = snr_db if snr_db is not None else change
  116. # Adding noise into base signal
  117. if add_noise[0] == 1:
  118. if base_snr == False:
  119. noise1, _ = snr_func.snr_to_noise(snr_aim, scaled1)
  120. else:
  121. noise_std = snr_func.snr_to_std(snr_db, before_trans_scaled)
  122. noise1 = np.random.normal(0, noise_std, size=len(scaled1))
  123. noisy_signal1 = scaled1 + noise1
  124. else:
  125. noisy_signal1 = scaled1
  126. # Do we compare with the noise signal
  127. if compare_with_noise:
  128. noisy_signal2 = np.random.normal(np.mean(scaled1), np.std(scaled1), size=len(noisy_signal1))
  129. # We compare with the transformed signal
  130. else:
  131. # If it is defined that the noise is added into both of the signals
  132. if add_noise[1] == 1:
  133. if base_snr == False:
  134. noise2, _ = snr_func.snr_to_noise(snr_aim, scaled2)
  135. else:
  136. noise_std = snr_func.snr_to_std(snr_db, before_trans_scaled)
  137. noise2 = np.random.normal(0, noise_std, size=len(scaled1))
  138. noisy_signal2 = scaled2 + noise2
  139. else:
  140. noisy_signal2 = scaled2
  141. # Possible outliers are added
  142. if outliers in ('one', 'both'):
  143. noisy_signal2 = transformations.add_outliers(noisy_signal2, change, zscore_range=z_score)
  144. if outliers == 'both':
  145. noisy_signal1 = transformations.add_outliers(noisy_signal1, change, zscore_range=z_score)
  146. # Calculating the results with the different estimators
  147. for estimator in estimator_list:
  148. estimator_function = estimator_list[estimator]
  149. estimator_value = estimator_function(noisy_signal1, noisy_signal2)
  150. # Adding change as a key when changes are used
  151. if change is not None:
  152. results[estimator].setdefault(change, []).append(float(estimator_value))
  153. else:
  154. results[estimator].append(estimator_value)
  155. pbar.update(1)
  156. return results
  157. def test_est_params(comp1, comp2,
  158. est, param_name, param_values,
  159. snr, n_runs=1_000, scaling_func=simulations.max_scaling):
  160. '''
  161. Testing how the choice of freeparameter impacts on the results of the different MI estimators.
  162. Parameters
  163. ----------
  164. comp1: np.array
  165. First signal to compare with the given estimator.
  166. comp2: np.array or float
  167. Second signal to compare with the given estimator.
  168. If a float is provided, a random noise signal is generated with the specified
  169. standard deviation (the float value) and the same length as `comp1`,
  170. and this noise signal is used as the second signal.
  171. est: callable
  172. Function of the estimator the be tested.
  173. param_name:
  174. The name of the freeparameter ti be changed in the given estimator function.
  175. param_values: list
  176. List of the free parameter values to test.
  177. snr: int
  178. Noise level (dB) to add in the given signals.
  179. n_runs: int, optional
  180. Number of iteration to run the simulation. The default is 1000.
  181. scaling_func: callable, optional
  182. A function used to scale the signals.
  183. if None no scaling is applied.
  184. By default scaling based on the shared maximum value of the two signals is applied.
  185. Returns
  186. -------
  187. param_results : dict
  188. A dictionary containing the results of the given similarity estimator
  189. across iterations where random noise is added
  190. while changing the given free parameter of the estimator.
  191. '''
  192. if scaling_func:
  193. comp1, comp2 = scaling_func(comp1, comp2)
  194. param_results = {}
  195. n_total = n_runs * len(param_values)
  196. with tqdm(total=n_total, desc='Total Progress') as pbar:
  197. for param in param_values:
  198. est_results = []
  199. for _ in range(n_runs):
  200. n1, _ = snr_func.snr_to_noise(snr, comp1)
  201. comp1_noise = comp1 + n1
  202. if isinstance(comp2, (float)):
  203. comp2_noise = np.random.normal(0, comp2, size=len(comp1))
  204. else:
  205. n2, _ = snr_func.snr_to_noise(snr, comp2)
  206. comp2_noise = comp2 + n2
  207. est_result = est(comp1_noise, comp2_noise, **{param_name: param})
  208. est_results.append(est_result)
  209. pbar.update(1)
  210. param_results[param] = est_results
  211. return param_results
  212. def save_sim_results(results, save_path):
  213. with open(save_path, 'wb') as f:
  214. pickle.dump(results, f)
  215. def get_sim_results(data_path):
  216. with open(data_path, 'rb') as f:
  217. results = pickle.load(f)
  218. return results

testing.py at commit a1c8fee, under GPL-3.0 · at the source

Overview

Authors: Anni Hukari1, Silvia Federica Cotroneo1, Riitta Salmelin1
  1. Department of Neuroscience and Biomedical Engineering, Aalto University,Rakentajanaukio 2, Espoo, 02150 Finland
Institutions: Aalto University (Finland)
Journal: Neuroinformatics, volume 24, issue 4, article 61
Dates: received 22 January 2026; accepted 10 April 2026; published online 16 September 2026; in print 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1007/s12021-026-09784-3 · PMID 42747602 · PMCID PMC13582061 · OpenAlex W7213296168
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: MEG (modality), human (organism), computational (subfield)
Methods: Preprocessing, Spectral & time-frequency, Connectivity, Statistics, Machine learning
Keywords: Mutual information, Pearson correlation, Similarity estimators, Neural evoked responses, Mutual information estimation, Neuroimaging
MeSH: Brain*, Evoked Potentials*, Models, Neurological*, Algorithms, Computer Simulation, Humans, Magnetoencephalography, Signal Processing, Computer-Assisted (* major topic)
Topic: Neural dynamics and brain function (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Aalto University
Citations: not cited yet (Europe PMC); 45 references in the paper

Abstract

In neural evoked responses, small variations in the timing or duration of responses can be observed when the same functional response is recorded in different trials, different experimental conditions or by different sensors. These variations limit the ability of correlation-based methods to detect similarities between signals. Mutual information (MI) provides an alternative similarity measure, capable of capturing both linear and non-linear dependencies, yet its practical use is hindered by lack of consensus on estimators for continuous data and the limited understanding of the behavior of the estimators on realistic signals. In this work, we investigate how to estimate the similarity of neural evoked responses by systematically comparing sample Pearson correlation with three of the most common MI estimators. We describe their behavior using both simulated signals and real magnetoencephalographic data. In the simulations, the estimators are tested against a set of transformations that depict realistic changes in neural evoked responses. Subsequently, we propose guidelines for defining adaptive lower bounds on the similarity estimates and analyzing the similarity rankings induced by the different estimators. Our findings reveal trade-offs between measures sensitivity and different signal properties. We confirm that Pearson correlation is reliable in describing linear relationships for low-noise signals, and we identify parameter settings that stabilize MI estimators, enabling them to capture complex signal dependencies. Together, these results introduce practical parameter choices and thresholding strategies for mutual information and provide guidance for selecting and interpreting similarity measures in the analysis of neural evoked time series.

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 1 match between paragraphs and lines of code.

AaltoImagingLanguage/micorr

License: GPL-3.0
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Commit: a1c8fee015bef424d41b173359fc39bb11178d0d, 14 April 2026
Languages: Python (27)
Size: 46 files, 27 scripts
Software Heritage: not archived
Found in: “Code Availability”
Holds: README, license file, environment (requirements.txt)
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (20 files), Matplotlib (5 files), MNE-Python (4 files), scikit-learn (2 files), SciPy (2 files), pandas (1 file)
Availability: 1 check, the latest on 26 September 2026: the link answers
  • 26 September 2026: the link answers
29 files

Code Availability

The code used to generate the simulated data is publicly available at https://github.com/AaltoImagingLanguage/micorr.

Reproduced under the paper's license (CC BY), from the paper cited above.

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;
  • 27 scripts, 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

No dataset and no data link were found in the paper.

Data Availability

The code used to generate the simulated data is publicly available at https://github.com/AaltoImagingLanguage/micorr. In agreement with the ethical permission and national privacy regulations at the time of the study, the raw MEG data cannot be made openly available.

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 3, 28 September 2026

  • Publisher: n/a → Springer Science+Business Media

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 6 keywords, 8 MeSH terms, 1 funder, 42 references.

Cite

This paper

Hukari, A., Cotroneo, S. F., & Salmelin, R. (2026). Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses. Neuroinformatics, 24(4), 61. https://doi.org/10.1007/s12021-026-09784-3

BibTeX

@article{hukari2026estimating,
author = {Hukari, Anni and Cotroneo, Silvia Federica and Salmelin, Riitta},
title = {{Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses}},
journal = {Neuroinformatics},
year = {2026},
month = sep,
volume = {24},
number = {4},
pages = {61},
publisher = {Springer Science+Business Media},
issn = {1539-2791},
doi = {10.1007/s12021-026-09784-3},
url = {https://doi.org/10.1007/s12021-026-09784-3},
pmid = {42747602},
pmcid = {PMC13582061}
}

RIS

TY - JOUR
AU - Hukari, Anni
AU - Cotroneo, Silvia Federica
AU - Salmelin, Riitta
TI - Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses
T2 - Neuroinformatics
J2 - Neuroinformatics
PY - 2026
DA - 2026/09/16
VL - 24
IS - 4
SP - 61
SN - 1539-2791
PB - Springer Science+Business Media
DO - 10.1007/s12021-026-09784-3
UR - https://doi.org/10.1007/s12021-026-09784-3
LA - en
ER -

CSL-JSON

{
"id": "10.1007/s12021-026-09784-3",
"type": "article-journal",
"title": "Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses",
"container-title": "Neuroinformatics",
"author": [
{
"family": "Hukari",
"given": "Anni"
},
{
"family": "Cotroneo",
"given": "Silvia Federica"
},
{
"family": "Salmelin",
"given": "Riitta"
}
],
"container-title-short": "Neuroinformatics",
"volume": "24",
"issue": "4",
"page": "61",
"DOI": "10.1007/s12021-026-09784-3",
"PMID": "42747602",
"PMCID": "PMC13582061",
"ISSN": "1539-2791",
"publisher": "Springer Science+Business Media",
"URL": "https://doi.org/10.1007/s12021-026-09784-3",
"language": "en",
"issued": {
"date-parts": [
[
2026,
9,
16
]
]
}
}

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.70628 [code]
EEG Biomarkers for Affective Disorders Diagnosis: An Evaluation and Validation Study.
Journal: Human brain mapping
In common: MNE-Python, scikit-learn, pandas, 3 other tools, 3 references
[2] doi:10.1016/j.patter.2026.101619 [code]
Sampling bias corrections for discrete and Gaussian partial information decompositions.
Journal: Patterns (New York, N.Y.)
In common: scikit-learn, pandas, SciPy, 2 other tools, 3 references
[3] doi:10.1371/journal.pone.0348005 [code]
THOI: An efficient and accessible library for computing higher-order interactions enhanced by batch-processing.
Journal: PloS one
In common: scikit-learn, pandas, SciPy, 2 other tools, 3 references
[4] 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-Python, scikit-learn, pandas, 3 other tools, MEG, 1 reference
[5] 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: MNE-Python, scikit-learn, pandas, 3 other tools, MEG, computational
[6] doi:10.1073/pnas.2536563123 [code]
Temporally structured motor and auditory representations in covert syllable production.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
[7] doi:10.1038/s41467-026-75240-0 [code]
Dynamic acoustic-to-categorical representations of phonemes and prosody along ventral and dorsal speech streams.
Journal: Nature communications
In common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
[8] doi:10.1523/eneuro.0041-26.2026 [code]
Ocular Speech Tracking Persists in Blindness, but Its Dynamics and Oculo-Cerebral Connectivity Depend on Visual Status.
Journal: eNeuro
In common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
[9] doi:10.1038/s41467-026-74824-0 [code]
Learning regularities in noise engages both neural predictive activity and representational changes.
Journal: Nature communications
In common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
[10] doi:10.1523/eneuro.0344-25.2026 [code]
Long-Term Variability in Visual Processing versus Perceptual Stability.
Journal: eNeuro
In common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG

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.