OSCR

Towards real-time additive-free dopamine detection at 10<sup>-8</sup> mM with hardware accelerated platform integrated on camera.

Code ↔ Paper

3 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 3 matches
  1. [1] § Results ↔ trainer.py, lines 11–139 · score 0.61 · R2 score, PCA components, ideal, monitoring, fitted, variance
  2. [2] § Results ↔ trainer.py, lines 11–139 · score 0.55 · square error, R2 score, fitted, regression, components, model
  3. [3] § Results ↔ run.py, lines 173–255 · score 0.50 · square error, R2 score, dopamine, components, model, predicted

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 · 166 lines · 5.9 KB · no license · 2 matches

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. from sklearn.decomposition import PCA
  4. from sklearn.metrics import mean_squared_error, r2_score
  5. from tensorflow import keras
  6. from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau
  7. from tensorflow.keras.layers import Dense
  8. from tensorflow.keras.models import Sequential
  9. class SpectraTrainer:
  10. def __init__(self, loader, n_pca=8):
  11. self.loader = loader
  12. self.n_pca = n_pca
  13. self._prepare_data()
  14. self._build_model()
  15. def _prepare_data(self):
  16. self.X_train, self.Y_train = self.loader.get_train_data()
  17. self.X_test, self.Y_test = self.loader.get_test_data()
  18. all_X, all_Y, all_Y_reg = self.loader.get_all_data()
  19. # PCA
  20. self.pca = PCA(n_components=self.n_pca, svd_solver="full")
  21. self.pca.fit(all_X)
  22. self.pca_components = self.pca.components_
  23. # Min-max normalize PC
  24. self.pc_train = np.matmul(self.X_train, self.pca_components.T)
  25. self.pc_min = np.min(self.pc_train, axis=0)
  26. self.pc_max = np.max(self.pc_train, axis=0)
  27. self.pc_train_normalized = (self.pc_train - self.pc_min) / (
  28. self.pc_max - self.pc_min
  29. )
  30. # Transform test data
  31. self.pc_test = np.matmul(self.X_test, self.pca_components.T)
  32. self.pc_test_normalized = (self.pc_test - self.pc_min) / (
  33. self.pc_max - self.pc_min
  34. )
  35. # print(f'PCA explained variance: {self.pca.explained_variance_ratio_}')
  36. # print(f'Total variance explained: {np.sum(self.pca.explained_variance_ratio_):.4f}')
  37. def _build_model(self):
  38. self.model = Sequential(name="spectra_regression")
  39. self.model.add(Dense(32, activation="relu", input_shape=(self.n_pca,)))
  40. self.model.add(Dense(64, activation="relu"))
  41. self.model.add(Dense(64, activation="relu"))
  42. self.model.add(Dense(1, activation="sigmoid"))
  43. optimizer = keras.optimizers.Adam(learning_rate=1e-3)
  44. self.model.compile(optimizer=optimizer, loss="mse", metrics=["mae"])
  45. def train(self, epochs=100, batch_size=8, verbose=1):
  46. early_stopper = EarlyStopping(monitor="loss", patience=15)
  47. reduce_lr = ReduceLROnPlateau(
  48. monitor="loss", factor=0.2, verbose=0, patience=4, min_lr=1e-6
  49. )
  50. self.history = self.model.fit(
  51. self.pc_train_normalized,
  52. self.Y_train,
  53. epochs=epochs,
  54. verbose=verbose,
  55. batch_size=batch_size,
  56. callbacks=[reduce_lr, early_stopper],
  57. )
  58. return self.history
  59. def evaluate(self):
  60. Y_pred = self.model.predict(self.pc_test_normalized, verbose=0).flatten()
  61. # Inverse transform to original concentration scale
  62. Y_test_orig = np.array([self.loader.inverse_transform(y) for y in self.Y_test])
  63. Y_pred_orig = np.array([self.loader.inverse_transform(y) for y in Y_pred])
  64. # Calculate metrics: MSE on normalized Y, R2 on original scale
  65. mse = mean_squared_error(self.Y_test, Y_pred)
  66. r2 = r2_score(Y_test_orig, Y_pred_orig)
  67. print(f"\nTest MSE (normalized): {mse:.6f}")
  68. print(f"Test R2 (original scale): {r2:.6f}")
  69. return Y_pred, Y_test_orig, Y_pred_orig, mse, r2
  70. def evaluate_on_all_data(self):
  71. all_X, all_Y, all_Y_reg = self.loader.get_all_data()
  72. pc_all = np.matmul(all_X, self.pca_components.T)
  73. pc_all_normalized = (pc_all - self.pc_min) / (self.pc_max - self.pc_min)
  74. Y_pred = self.model.predict(pc_all_normalized, verbose=0).flatten()
  75. # Inverse transform to original concentration scale
  76. Y_orig = np.array([self.loader.inverse_transform(y) for y in all_Y_reg])
  77. Y_pred_orig = np.array([self.loader.inverse_transform(y) for y in Y_pred])
  78. # Calculate metrics: MSE on normalized Y, R2 on original scale
  79. mse = mean_squared_error(all_Y_reg, Y_pred)
  80. r2 = r2_score(Y_orig, Y_pred_orig)
  81. print(f"\nAll Data MSE (normalized): {mse:.6f}")
  82. print(f"All Data R2 (original scale): {r2:.6f}")
  83. return Y_pred, Y_orig, Y_pred_orig, mse, r2
  84. def visualize(self, mse, r2):
  85. Y_pred = self.model.predict(self.pc_test_normalized, verbose=0).flatten()
  86. Y_test_orig = np.array([self.loader.inverse_transform(y) for y in self.Y_test])
  87. Y_pred_orig = np.array([self.loader.inverse_transform(y) for y in Y_pred])
  88. # Get concentration list for x-axis
  89. c_list = self.loader.selected_concentrations
  90. x_ax = np.arange(np.min(c_list), np.max(c_list) + 1)
  91. plt.figure(figsize=(10, 8))
  92. plt.plot(x_ax, x_ax, "b", linewidth=2)
  93. plt.scatter(
  94. Y_test_orig, Y_pred_orig, marker="d", color="green", alpha=0.8, s=60
  95. )
  96. plt.legend(["Ideal fit", "Model Prediction"], fontsize=16)
  97. # Create tick labels
  98. ticks = []
  99. for c in x_ax:
  100. ticks.append("$10^{" + str(int(c)) + "}$")
  101. plt.xticks(x_ax, ticks, fontsize=12)
  102. plt.yticks(x_ax, ticks, fontsize=12)
  103. plt.title("mse={:.4f}, r2={:.4f}".format(mse, r2))
  104. return plt.gcf()
  105. def save_model(self, save_path):
  106. self.model.save(save_path)
  107. # np.save(save_path.replace('.h5', '_pca.npy'), self.pca_components)
  108. print(f"Model saved to {save_path}")
  109. if __name__ == "__main__":
  110. from dataloader import SpectraDataLoader
  111. loader = SpectraDataLoader(
  112. data_dir="./data/dopamine_pbs",
  113. split_by_batch=False,
  114. concentration_list=[0, -11, -10, -9, -8, -7, -6],
  115. norm_type="anchor",
  116. test_ratio=0.25,
  117. )
  118. trainer = SpectraTrainer(loader=loader, n_pca=8)
  119. print("\nTraining model...")
  120. trainer.train(epochs=100, batch_size=8, verbose=1)
  121. print("\nEvaluating model...")
  122. Y_pred, Y_test_orig, Y_pred_orig, mse, r2 = trainer.evaluate()
  123. print("\nEvaluating on all data...")
  124. _ = trainer.evaluate_on_all_data()
  125. print("\nVisualizing results...")
  126. fig = trainer.visualize(mse, r2)
  127. plt.show()

trainer.py at commit 8e7e734, no license · at the source

Overview

  1. PRIMALIGHT, Faculty of Electrical and Computer Engineering, King Abdullah University of Science and Technology (KAUST), Thuwal, Saudi Arabia
Journal: Nature communications, volume 17, issue 1, article 7176
Dates: received 12 March 2025; accepted 25 May 2026; published online 4 June 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-73932-1 · PMID 42243130 · PMCID PMC13396668 · OpenAlex W4415108880
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), methods / tools (subfield)
Keywords: Nanobiotechnology, Sensors and probes, Medical research, Optical spectroscopy, Neuroscience
MeSH: Dopamine*, Electrochemical Techniques*, Ascorbic Acid, Humans, Uric Acid (* major topic)
Topic: EEG and Brain-Computer Interfaces (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 91 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repositories

Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.

QizhouW/Hardware-accelerated-Dopamine-Sensing

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 8e7e7341813d65aca7de5be805cc4ddecc70dc76, 5 April 2026
Languages: Python (6)
Size: 159 files, 6 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (6 files), Keras (4 files), Matplotlib (4 files), scikit-learn (4 files), TensorFlow (4 files), pandas (2 files)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
7 files

Zenodo 19430063

License: CC-BY-4.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: the references
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (3 files), Keras (2 files), Matplotlib (2 files), scikit-learn (2 files), TensorFlow (2 files), pandas (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
4 files
At the source:

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41467-026-73932-1.

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;
  • 9 scripts, each with its path and the digest of its content;
  • 3 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 statement

The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

  • no repository, dataset or request procedure was recognized in it

Read it in the paper: doi.org/10.1038/s41467-026-73932-1.

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

  • Funding: added King Abdullah University of Science and Technology

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 5 keywords, 5 MeSH terms, 58 references.

Cite

This paper

Li, N., Wang, Q., He, Z., Burguete-Lopez, A., Xiang, F., & Fratalocchi, A. (2026). Towards real-time additive-free dopamine detection at 10<sup>-8</sup> mM with hardware accelerated platform integrated on camera. Nature communications, 17(1), 7176. https://doi.org/10.1038/s41467-026-73932-1

BibTeX

@article{li2026towards,
author = {Li, Ning and Wang, Qizhou and He, Zhao and Burguete-Lopez, Arturo and Xiang, Fei and Fratalocchi, Andrea},
title = {{Towards real-time additive-free dopamine detection at 10\<sup\>-8\</sup\> mM with hardware accelerated platform integrated on camera}},
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {7176},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-73932-1},
url = {https://doi.org/10.1038/s41467-026-73932-1},
pmid = {42243130},
pmcid = {PMC13396668}
}

RIS

TY - JOUR
AU - Li, Ning
AU - Wang, Qizhou
AU - He, Zhao
AU - Burguete-Lopez, Arturo
AU - Xiang, Fei
AU - Fratalocchi, Andrea
TI - Towards real-time additive-free dopamine detection at 10<sup>-8</sup> mM with hardware accelerated platform integrated on camera
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/06/04
VL - 17
IS - 1
SP - 7176
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-73932-1
UR - https://doi.org/10.1038/s41467-026-73932-1
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-73932-1",
"type": "article-journal",
"title": "Towards real-time additive-free dopamine detection at 10<sup>-8</sup> mM with hardware accelerated platform integrated on camera",
"container-title": "Nature communications",
"author": [
{
"family": "Li",
"given": "Ning"
},
{
"family": "Wang",
"given": "Qizhou"
},
{
"family": "He",
"given": "Zhao"
},
{
"family": "Burguete-Lopez",
"given": "Arturo"
},
{
"family": "Xiang",
"given": "Fei"
},
{
"family": "Fratalocchi",
"given": "Andrea"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "7176",
"DOI": "10.1038/s41467-026-73932-1",
"PMID": "42243130",
"PMCID": "PMC13396668",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-73932-1",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
4
]
]
}
}

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.1177/13872877261453512 [code]
Fluorescence spectroscopy and machine learning methods for detection of Alzheimer's disease from circulating white blood cells.
Journal: Journal of Alzheimer's disease : JAD
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[2] doi:10.1038/s41598-026-52330-z [code]
SHAP analysis of an improved EEG-based mental workload classification framework: utilizing data augmentation and explainable AI.
Journal: Scientific reports
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[3] doi:10.1371/journal.pone.0347867 [code]
LiteFeatNet: A parameter-efficient and performance-centric deep learning model for multi-ocular disease identification using intermediate feature reduction from fundus images.
Journal: PloS one
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[4] doi:10.1002/nbm.70263 [code]
Cross-Site Generalization of CNN-Based $$ {B}_1^{+} $$ Mapping in UHF MRI.
Journal: NMR in biomedicine
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[5] doi:10.1186/s12938-026-01555-0 [code]
Incorporating normal periventricular changes for enhanced pathological white matter hyperintensity segmentation: on multiclass deep learning approaches.
Journal: Biomedical engineering online
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[6] doi:10.1038/s41597-026-07184-5 [code]
A Multiple Sclerosis MRI Dataset with Tri-Mask Annotations for Lesion Segmentation.
Journal: Scientific data
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[7] doi:10.1038/s41592-026-03057-2 [code]
CREsted: modeling genomic and synthetic cell-type-specific enhancers across tissues and species.
Journal: Nature methods
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[8] doi:10.1038/s41598-026-42310-8 [code]
Sleep awake detection from leg-worn wearables using deep sensor fusion.
Journal: Scientific reports
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[9] doi:10.1038/s41597-025-05174-7 [code]
A large-scale MEG and EEG dataset for object recognition in naturalistic scenes
Journal: n/a
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools
[10] doi:10.1126/sciadv.aed3650 [code]
Truthful visualizations for mass spectrometry imaging enable high-spatial-resolution interactive <i>m/z</i> mapping and exploration.
Journal: Science advances
In common: Keras, TensorFlow, scikit-learn, 3 other tools, methods / tools

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.