OSCR

Characterizing developmental changes in infant habituation using functional change point detection.

Code ↔ Paper

8 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 8 matches · 1 of them tie a paragraph to a whole file, not to given lines: a weak match, whose lines are not tinted
  1. [1] § Methods › Further Analysis of Statistically Significant Change Points › Analyzing the effect of age ↔ statsScripts/statGroupChangePoints.ipynb, lines 498–581 · score 0.75 · Weighted ordinal logistic, OrderedModel, post hoc, logit, predictors, fit
  2. [2] § Methods › Data Processing ↔ scripts/generateSimulatedHabituationData.ipynb, lines 123–237 · score 0.65 · low pass filter, stimulus onset, cutoff, oscillations, linearly, channel
  3. [3] § Methods › Detecting Changes in the Evoked Hemodynamic Response ↔ plotting/plotSimulatedCUSUM.ipynb, the whole file · a weak match · score 0.62 · CUSUM statistics, Brownian Bridges, anchored, simulated, absolute, deviations
  4. [4] § Appendix B: FCPt significance testing with Brownian Bridges ↔ functions/funcChangePoint.py, lines 29–119 · score 0.62 · wild binary segmentation, Brownian Bridge, interval, recursive, component, sum
  5. [5] § Methods › Detecting Changes in the Evoked Hemodynamic Response › Monte Carlo simulation to assess functional change point significance ↔ functions/funcChangePoint.py, lines 29–119 · score 0.60 · wild binary segmentation, Brownian Bridges, interval, summed
  6. [6] § Methods › Further Analysis of Statistically Significant Change Points › Analyzing the effect of age ↔ statsScripts/statIindigoIndividualChangePoints.ipynb, lines 789–867 · score 0.59 · post hoc Wald, ANOVA model, HSD, Tukey, Pairwise
  7. [7] § Methods › Data Processing ↔ functions/fNIRSData.py, lines 530–557 · score 0.53 · Linear detrending, stimulus onset
  8. [8] § Results ↔ plotting/viewGroupCPts.ipynb, lines 118–233 · score 0.51 · month participants, concentration change, ROI channel, surface, Chromophore

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 · 183 lines · 7.5 KB · MIT · 2 matches

  1. import skfda
  2. import numpy as np
  3. import pandas as pd
  4. from skfda.preprocessing.dim_reduction import FPCA
  5. from skfda.representation.basis import BSplineBasis
  6. import sys
  7. from pathlib import Path
  8. # Root of this project (the folder containing this notebook, or an ancestor of
  9. # it, named 'FDA'). Walks up from the current working directory until it finds
  10. # one. (Same pattern used throughout this project's notebooks.)
  11. cwd = Path().resolve()
  12. if cwd.name == 'FDA':
  13. projectRoot = cwd
  14. else:
  15. for parent in cwd.parents:
  16. if parent.name == 'FDA':
  17. projectRoot = parent
  18. break
  19. else:
  20. raise FileNotFoundError("Could not find FDA project root")
  21. sys.path.append(str(projectRoot / 'functions'))
  22. import auxFuncChPt as auxF
  23. ##########################################################################################################################################
  24. def changeFPCA(fdObj, dHat=0, numBootstrap=10000, h=0, plot=False, longRun=True, wildBinSeg=False, numIntervals=500, *args, **kwargs):
  25. #check fd input object is in the correct form
  26. if not(isinstance(fdObj, skfda.representation.basis._fdatabasis.FDataBasis)
  27. or isinstance(fdObj, skfda.representation.grid.FDataGrid)):
  28. #return error if not
  29. raise ValueError("Must use functional data in basis representation or grid form")
  30. if isinstance(fdObj, skfda.representation.basis._fdatabasis.FDataBasis):
  31. N = fdObj.coefficients[:, 0].shape[0] # First dimension = rows = number of functional objects
  32. D = fdObj.coefficients[0].shape[0] # Second dimension = columns = number of basis functions
  33. else:
  34. #if FDataGrid
  35. N = fdObj.data_matrix.shape[0] # First dimension = rows = number of functional objects
  36. #num fPCs must be less than size of dataset and of number of sample points
  37. D = np.min([(N-1), (fdObj.data_matrix.shape[1])]) #set to min of these two values
  38. #set up PCA with full number of components
  39. #fPCA = FPCA(n_components=D) #centering = TRUE applied as default
  40. #find variance for each fPC
  41. #fPCAScores = fPCA.fit_transform(fdObj) #requires scores/comps to first be calculated
  42. # calculate fPCA
  43. # check if specific number of PCs desired in reconstruction; find them using threshold (default 85%) if not
  44. if not(dHat):
  45. dHat = auxF.cumulPercVariance(fdObj)
  46. dHat = min(N, dHat)
  47. #set up PCA with required number of components
  48. fPCA = FPCA(n_components=dHat) #centering = TRUE applied as default
  49. #find variance for each fPC
  50. fPCAScores = fPCA.fit_transform(fdObj) #requires scores/comps to first be calculated
  51. # Auto-select h if not provided
  52. if longRun == True:
  53. if h == 0: #if lag not provided
  54. h = int(4 * (N / 100) ** (2 / 9)) # calculate using Newey-West rule, via. Andrews (1991)
  55. h = np.min([h, N-1]) #adjust lag if not enough functional data in this recursive iteration of binseg
  56. else:
  57. h = 0 #just in case non-zero lag given when not using the L-R covariance
  58. #calculate (long-run) covariance
  59. sigmaHat = auxF.calcLRCovGrid(fPCAScores, d = dHat, h = h)
  60. #invert it for partial sum calculation
  61. invSigmaHat = np.linalg.inv(sigmaHat).astype('float64')
  62. if wildBinSeg:
  63. # Wild Binary Segmentation approach
  64. intervals = auxF.generateRandomIntervals(N, numIntervals)
  65. maxT_NAll = []
  66. kStarAll = []
  67. for startIdx, endIdx in intervals:
  68. intervalLength = endIdx - startIdx
  69. T_N = np.empty(intervalLength)
  70. for k in range(intervalLength):
  71. L_Nk = auxF.computeIntervalPartialSumFPCA(k, fPCAScores, dHat, startIdx, endIdx)
  72. T_N[k] = (1/intervalLength) * (np.dot(np.transpose(L_Nk), (np.dot(invSigmaHat, L_Nk))))
  73. maxT_N = np.max(np.abs(T_N))
  74. kStar_interval = (np.where(np.abs(T_N) == maxT_N))[0][0]
  75. maxT_NAll.append((maxT_N, kStar_interval + startIdx))
  76. # Find interval with maximum test statistic
  77. maxT_N, kStar = max(maxT_NAll, key=lambda x: x[0])
  78. else:
  79. # Original approach
  80. T_N = np.empty(N)
  81. for k in range(N):
  82. L_Nk = auxF.computeIntervalPartialSumFPCA(k, fPCAScores, dHat)
  83. T_N[k] = (1/N) * (np.dot(np.transpose(L_Nk), (np.dot(invSigmaHat, L_Nk))))
  84. maxT_N = np.max(np.abs(T_N))
  85. kStar = (np.where(T_N == maxT_N))[0][0]
  86. # Bootstrap and significance calculation
  87. bridgeVals = auxF.brownianBridgeBootstrap(dHat, N, numPerms=numBootstrap)
  88. z = np.sum((maxT_N <= bridgeVals) == True)
  89. pValue = z / (bridgeVals.shape)[0]
  90. # Calculate means
  91. preChangeFuncs = (fdObj[:kStar])
  92. preChangeMean = skfda.exploratory.stats.mean(preChangeFuncs)
  93. postChangeFuncs = (fdObj[kStar:])
  94. postChangeMean = skfda.exploratory.stats.mean(postChangeFuncs)
  95. deltaMeans = preChangeMean - postChangeMean
  96. return kStar, pValue, maxT_N, preChangeMean, postChangeMean, deltaMeans, dHat
  97. ##########################################################################################################################################
  98. def changeFF(fdObj, numBootstrap=10000, h=0, firstSamp=-20, lastSamp=182, numComponents=15, plot=False, longRun=True, wildBinSeg=False, numBinSegIntervals=500, *args, **kwargs):
  99. # Original input checks and setup remain the same
  100. if not(isinstance(fdObj, skfda.representation.basis._fdatabasis.FDataBasis)
  101. or isinstance(fdObj, skfda.representation.grid.FDataGrid)):
  102. raise ValueError("Must use functional data in basis representation or grid form")
  103. if isinstance(fdObj, skfda.representation.grid.FDataGrid):
  104. basis = BSplineBasis(n_basis=numComponents)
  105. fdObj = fdObj.to_basis(basis)
  106. coefs = fdObj.coefficients.astype('float64')
  107. N = coefs[:, 0].shape[0]
  108. D = coefs[0].shape[0]
  109. if wildBinSeg:
  110. intervals = auxF.generateRandomIntervals(N, numBinSegIntervals)
  111. allMaxPartialSum = []
  112. kStarAll = []
  113. for startIdx, endIdx in intervals:
  114. S_N = auxF.computeIntervalPartialSumFF(coefs, startIdx, endIdx)
  115. maxS_N = np.max(np.abs(S_N))
  116. kStar = (np.where(S_N == maxS_N))[0][0]
  117. allMaxPartialSum.append((maxS_N, kStar + startIdx, endIdx - startIdx))
  118. maxS_N, kStar, segSize = max(allMaxPartialSum, key=lambda x: x[0])
  119. else:
  120. S_N = np.zeros([N])
  121. for i in range(2, N):
  122. S_N[i-1] = (np.sum((np.sum(coefs[0:i, :], axis=0) -
  123. (i/N) * np.sum(coefs, axis=0))**2)) / N
  124. maxS_N = np.max(np.abs(S_N))
  125. kStar = (np.where(np.abs(S_N) == maxS_N))[0][0]
  126. segSize = N
  127. if longRun:
  128. if h == 0:
  129. h = int(4 * (N / 100) ** (2 / 9))
  130. h = np.min([h, N-1])
  131. else:
  132. h = 0
  133. covMat = auxF.calcLRCovBasis(fdObj, h=h)
  134. eigCovMat = np.linalg.eigh(covMat)
  135. eigValsCV = eigCovMat.eigenvalues
  136. basis = BSplineBasis(n_basis=D)
  137. bridgeVals = auxF.eigValBridgeBootstrap(D, segSize, eigValsCV, numPerms=numBootstrap) # adjusted for segment size - important!
  138. z = np.sum((maxS_N <= bridgeVals) == True)
  139. pValue = z / (bridgeVals.shape)[0]
  140. preChangeFuncs = (fdObj[:kStar])
  141. preChangeMean = np.mean(preChangeFuncs)
  142. postChangeFuncs = (fdObj[kStar:])
  143. postChangeMean = np.mean(postChangeFuncs)
  144. deltaMeans = preChangeMean - postChangeMean
  145. return kStar, pValue, S_N, maxS_N, preChangeMean, postChangeMean, deltaMeans

funcChangePoint.py at commit 6934213, under MIT · at the source

Overview

Authors: Samuel Beaton1, Samantha McCann1, Sarah Lloyd-Fox2, Clare E. Elwell3, Ebrima Mbye4, Anna Blasi Ribera3, Sophie E. Moore1,4
  1. King’s College London, Department of Women & Children’s Health, London, United Kingdom
  2. University of Cambridge, Department of Psychology, Cambridge, United Kingdom
  3. University College London, Department of Medical Physics and Biomedical Engineering, London, United Kingdom
  4. Medical Research Council Unit The Gambia at the London School of Hygiene and Tropical Medicine, Fajara, The Gambia
Institutions: King's College London (United Kingdom); University of Cambridge (United Kingdom); University College London (United Kingdom); MRC Unit the Gambia (Gambia)
Journal: Neurophotonics, volume 13, issue 3, article 035006
Dates: received 30 March 2026; accepted 21 July 2026; published online 13 August 2026; in print July 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1117/1.nph.13.3.035006 · PMID 42598662 · PMCID PMC13472488 · OpenAlex W7202384757
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: fNIRS (modality), human (organism), developmental (subfield)
Methods: Statistics, Machine learning, Preprocessing, fMRI & imaging, Single-unit activity, calcium imaging, Spectral & time-frequency
Keywords: functional near-infrared spectroscopy, functional data analysis, functional change point detection, habituation, neurodevelopment, infancy
Topic: Optical Imaging and Spectroscopy Techniques (Radiology, Nuclear Medicine and Imaging, Medicine), according to OpenAlex
Funding: Gates Foundation (OPP1127625); Medical Research Council (MC-A760-5QX00); UK Research and Innovation (MR/S018425/1); Wellcome Trust (220225/Z/20/Z)
Citations: not cited yet (Europe PMC); 93 references in the paper

Abstract

Significance: Habituation is an early-developing cognitive process linked to learning, typically reflected in functional near-infrared spectroscopy (fNIRS) studies as a reduction in evoked hemodynamic response amplitude. Conventional fNIRS analyses rely on linear time-invariance assumptions, potentially limiting insight into how responses evolve across repeated stimulus presentations.

Aim: To determine whether functional change point (FCPt) detection can characterize trial-specific changes in the infant hemodynamic response and reveal developmental differences in habituation timing.

Approach: Functional data analysis (FDA) treats entire response curves as statistical objects. Within this framework, FCPt detection identifies statistically significant structural shifts in the mean response across trials. FCPt detection with wild binary segmentation was applied to group-level infant fNIRS data (n=204) collected from infants living in rural Gambia at 5, 8, and 12 months of age during a habituation and novelty detection paradigm.

Results: Significant changes were identified within auditory cortical regions. A high proportion of detected change points corresponded to decreases in response magnitude at 8 and 12 months. Weighted ordinal regression revealed an age-related shift toward earlier occurrence of decreasing change points, with older infants’ change points detected earlier within the trial sequence.

Conclusion: FCPt detection provides temporal information on the infant hemodynamic response unavailable to conventional analysis. At the group level, this additional information has revealed an age-related difference in habituation timing during the first year of life, with older infants completing habituation sooner. This represents a previously overlooked developmental change in the habituation response. Future work on individual-level data may seek to investigate these findings with greater granularity.

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 8 matches between paragraphs and lines of code.

sam-beaton/fcpt

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 6934213b1994f8e78b5d15be0ce13d3c2436cfb7, 24 August 2026
Languages: Jupyter (30), Python (6)
Size: 62 files, 36 scripts
Software Heritage: not checked
Found in: “Code and Data Availability”
Holds: README, license file, environment (requirements.txt), 30 notebooks
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (34 files), SciPy (30 files), pandas (29 files), Matplotlib (25 files), statsmodels (15 files), NiBabel (10 files), h5py (9 files), Plotly (6 files), seaborn (6 files), scikit-posthocs (2 files), statannotations (2 files), ANTs (1 file), NetworkX (1 file), scikit-image (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
38 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;
  • 36 scripts, each with its path and the digest of its content;
  • 8 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.

Code and Data Availability

The code used to conduct the analyses and generate the figures presented in this paper are available at https://github.com/sam-beaton/fcpt and rely on the following open source Python packages: h5py,75 numpy,76 matplotlib,77 os,78 pandas,79 pickle,80 scikit-fda,81 scipy,50 statistics,82 sys.83 The data used to support this study are stored in the Brain Imaging for Global Health Data Repository. The conditions of ethics approval do not allow public archiving of pseudo-anonymized study data. The data cannot be fully anonymized due to the nature of combined sources of information, such as neuroimaging, sociodemographic, geographic, and health measures, making it possible to attribute data to specific individuals. Hence, the release of data would not be compliant with GDPR guidelines unless additional participant consent forms are completed.12 Access to any data collected during or generated by the BRIGHT project is fully audited and, to ensure data security, is overseen by the data management team in the UK and The Gambia. Relevant data sharing procedures were created in consultation with stakeholders and external consultation.84 To access the data, interested readers should use the Contact page of the BRIGHT website. Access will be granted to named individuals following ethical procedures governing the reuse of sensitive data. Specifically, requestors must pre-register their proposal and clearly explain the planned analysis to ensure that the purpose and nature of the research is consistent with that to which participating families originally consented. In addition, requestors must complete and sign a data sharing agreement to ensure data is stored securely. Approved projects would need to adhere to the BRIGHT project’s policies on ethics, data sharing, authorship, and publication.

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, 7 authors, 6 keywords, 4 funders, 69 references.

Cite

This paper

Beaton, S., McCann, S., Lloyd-Fox, S., Elwell, C. E., Mbye, E., Blasi Ribera, A., & Moore, S. E. (2026). Characterizing developmental changes in infant habituation using functional change point detection. Neurophotonics, 13(3), 035006. https://doi.org/10.1117/1.nph.13.3.035006

BibTeX

@article{beaton2026characterizing,
author = {Beaton, Samuel and McCann, Samantha and Lloyd-Fox, Sarah and Elwell, Clare E. and Mbye, Ebrima and Blasi Ribera, Anna and Moore, Sophie E.},
title = {{Characterizing developmental changes in infant habituation using functional change point detection}},
journal = {Neurophotonics},
year = {2026},
month = jul,
volume = {13},
number = {3},
pages = {035006},
publisher = {Society of Photo-Optical Instrumentation Engineers},
issn = {2329-423X},
doi = {10.1117/1.nph.13.3.035006},
url = {https://doi.org/10.1117/1.nph.13.3.035006},
pmid = {42598662},
pmcid = {PMC13472488}
}

RIS

TY - JOUR
AU - Beaton, Samuel
AU - McCann, Samantha
AU - Lloyd-Fox, Sarah
AU - Elwell, Clare E.
AU - Mbye, Ebrima
AU - Blasi Ribera, Anna
AU - Moore, Sophie E.
TI - Characterizing developmental changes in infant habituation using functional change point detection
T2 - Neurophotonics
J2 - Neurophotonics
PY - 2026
DA - 2026/07/01
VL - 13
IS - 3
SP - 035006
SN - 2329-423X
PB - Society of Photo-Optical Instrumentation Engineers
DO - 10.1117/1.nph.13.3.035006
UR - https://doi.org/10.1117/1.nph.13.3.035006
LA - en
ER -

CSL-JSON

{
"id": "10.1117/1.nph.13.3.035006",
"type": "article-journal",
"title": "Characterizing developmental changes in infant habituation using functional change point detection",
"container-title": "Neurophotonics",
"author": [
{
"family": "Beaton",
"given": "Samuel"
},
{
"family": "McCann",
"given": "Samantha"
},
{
"family": "Lloyd-Fox",
"given": "Sarah"
},
{
"family": "Elwell",
"given": "Clare E."
},
{
"family": "Mbye",
"given": "Ebrima"
},
{
"family": "Blasi Ribera",
"given": "Anna"
},
{
"family": "Moore",
"given": "Sophie E."
}
],
"container-title-short": "Neurophotonics",
"volume": "13",
"issue": "3",
"page": "035006",
"DOI": "10.1117/1.nph.13.3.035006",
"PMID": "42598662",
"PMCID": "PMC13472488",
"ISSN": "2329-423X",
"publisher": "Society of Photo-Optical Instrumentation Engineers",
"URL": "https://doi.org/10.1117/1.nph.13.3.035006",
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
1
]
]
}
}

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.pone.0358044 [code]
An exploratory fNIRS study on directional asymmetry in segmental discrimination: Lateral-rhotic (/la-ra/) and labial-dorsal (/ba-ga/) contrasts tested in 5- and 9-month-old Japanese infants.
Journal: PloS one
In common: seaborn, pandas, SciPy, 2 other tools, fNIRS, developmental, 6 references
[2] doi:10.1002/alz.71649 [code]
Postmortem brain MRI reveals differential associations of subcortical and limbic volumes with cortical thinning and neurodegenerative pathologies.
Journal: Alzheimer's & dementia : the journal of the Alzheimer's Association
In common: statannotations, ANTs, Plotly, 8 other tools
[3] doi:10.1162/imag.a.1276 [code]
High-resolution whole-brain magnetic resonance spectroscopic imaging in youth at risk for psychosis.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: ANTs, NetworkX, Plotly, 7 other tools, 1 reference
[4] doi:10.21203/rs.3.rs-9326213/v1 [code]
Multi-task fMRI outperforms resting-state fMRI for revealing task-invariant organization of the human brain
Journal: Research Square (preprint)
In common: statannotations, ANTs, Plotly, 7 other tools
[5] doi:10.1016/j.isci.2026.117375 [code]
Motor priming is associated with widespread recruitment into neural ensembles and more rapid ensemble transitions.
Journal: iScience
In common: scikit-posthocs, NetworkX, h5py, 6 other tools, 1 reference
[6] doi:10.1371/journal.pbio.3003856 [code]
Aging and metabolism contribute separately to brain-body health.
Journal: PLoS biology
In common: ANTs, statsmodels, NiBabel, 5 other tools, 3 references
[7] doi:10.3389/fncom.2026.1786996 [code]
Schumann-anchored golden ratio organization of human neural oscillations.
Journal: Frontiers in computational neuroscience
In common: NetworkX, h5py, statsmodels, 6 other tools, 2 references
[8] doi:10.1117/1.nph.12.2.025011 [code]
NIRSTORM: a Brainstorm extension dedicated to functional near-infrared spectroscopy data analysis, advanced 3D reconstructions, and optimal probe design
Journal: —
In common: Matplotlib, NumPy, fNIRS, 6 references
[9] doi:10.7554/elife.108408 [code]
Frequency and laminar profile of feature-specific visual activity revealed by interleaved EEG-fMRI.
Journal: eLife
In common: ANTs, scikit-image, h5py, 7 other tools
[10] doi:10.1038/s41467-026-72057-9 [code]
Sex-specific behavioral feedback modulates sensorimotor processing and drives flexible social behavior.
Journal: Nature communications
In common: statannotations, scikit-image, h5py, 6 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.

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.