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.

2 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 3 matches
  1. [1] § Results ↔ trainer.py, lines 11 to 139 · score 0.61 · R2 score, PCA components, ideal, monitoring, fitted, variance · block oscr:b:HHJF63C04ZYS3-4 · Report a mismatch
  2. [2] § Results ↔ trainer.py, lines 11 to 139 · score 0.55 · square error, R2 score, fitted, regression, components, model · block oscr:b:HHJF63C04ZYS3-4 · Report a mismatch
  3. [3] § Results ↔ run.py, lines 173 to 255 · score 0.50 · square error, R2 score, dopamine, components, model, predicted · block oscr:b:H5WPG6N9PRMKP-D · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: 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 (how the code is found and 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 Portfolio},
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 Portfolio
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 Portfolio",
"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.1038/s41531-024-00647-9 [code]
Exploiting macro- and micro-structural brain changes for improved Parkinson's disease classification from MRI data.
Journal: NPJ Parkinson's disease
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[2] doi:10.1007/s10462-025-11347-y [code]
Applications of machine learning for computer-aided diagnosis of Parkinson's disease: progress and benchmark case study.
Journal: Artificial intelligence review
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[3] doi:10.7150/thno.111550 [code]
Deep learning identifies TP-41 for methylglyoxal scavenging in Alzheimer's treatment.
Journal: Theranostics
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[4] doi:10.1038/s41467-025-61650-z [code]
Machine learning in Alzheimer's disease genetics.
Journal: Nature communications
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[5] doi:10.1088/1361-6579/adce52 [code]
Visualizing functional network connectivity differences using an explainable machine-learning method.
Journal: Physiological measurement
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[6] doi:10.7554/elife.81067 [code]
Biological brain age prediction using machine learning on structural neuroimaging data: Multi-cohort validation against biomarkers of Alzheimer's disease and neurodegeneration stratified by sex.
Journal: eLife
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[7] doi:10.3389/fneur.2022.809343 [code]
Combination of Radiological and Clinical Baseline Data for Outcome Prediction of Patients With an Acute Ischemic Stroke.
Journal: Frontiers in neurology
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[8] doi:10.1038/s41586-023-06905-9 [code]
Targeted design of synthetic enhancers for selected tissues in the Drosophila embryo.
Journal: Nature
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[9] doi:10.1016/j.xpro.2023.102320 [code]
WaveMAP for identifying putative cell types from in vivo electrophysiology.
Journal: STAR protocols
In common: Keras, TensorFlow, scikit-learn, 3 other tools, 1 reference
[10] doi:10.1186/s12915-025-02148-4 [code]
An ensemble deep learning framework for multi-class LncRNA subcellular localization with innovative encoding strategy.
Journal: BMC biology
In common: Keras, TensorFlow, scikit-learn, 2 other tools, methods / 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.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41467-026-73932-1.svg)](https://openscicode.org/badge/doi/10.1038/s41467-026-73932-1)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-73932-1.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41467-026-73932-1
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-73932-1"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-73932-1.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge 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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.