Towards real-time additive-free dopamine detection at 10<sup>-8</sup> mM with hardware accelerated platform integrated on camera.
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] § 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] § 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] § 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
- import matplotlib.pyplot as plt
- import numpy as np
- from sklearn.decomposition import PCA
- from sklearn.metrics import mean_squared_error, r2_score
- from tensorflow import keras
- from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau
- from tensorflow.keras.layers import Dense
- from tensorflow.keras.models import Sequential
- class SpectraTrainer:
- def __init__(self, loader, n_pca=8):
- self.loader = loader
- self.n_pca = n_pca
- self._prepare_data()
- self._build_model()
- def _prepare_data(self):
- self.X_train, self.Y_train = self.loader.get_train_data()
- self.X_test, self.Y_test = self.loader.get_test_data()
- all_X, all_Y, all_Y_reg = self.loader.get_all_data()
- # PCA
- self.pca = PCA(n_components=self.n_pca, svd_solver="full")
- self.pca.fit(all_X)
- self.pca_components = self.pca.components_
- # Min-max normalize PC
- self.pc_train = np.matmul(self.X_train, self.pca_components.T)
- self.pc_min = np.min(self.pc_train, axis=0)
- self.pc_max = np.max(self.pc_train, axis=0)
- self.pc_train_normalized = (self.pc_train - self.pc_min) / (
- self.pc_max - self.pc_min
- )
- # Transform test data
- self.pc_test = np.matmul(self.X_test, self.pca_components.T)
- self.pc_test_normalized = (self.pc_test - self.pc_min) / (
- self.pc_max - self.pc_min
- )
- # print(f'PCA explained variance: {self.pca.explained_variance_ratio_}')
- # print(f'Total variance explained: {np.sum(self.pca.explained_variance_ratio_):.4f}')
- def _build_model(self):
- self.model = Sequential(name="spectra_regression")
- self.model.add(Dense(32, activation="relu", input_shape=(self.n_pca,)))
- self.model.add(Dense(64, activation="relu"))
- self.model.add(Dense(64, activation="relu"))
- self.model.add(Dense(1, activation="sigmoid"))
- optimizer = keras.optimizers.Adam(learning_rate=1e-3)
- self.model.compile(optimizer=optimizer, loss="mse", metrics=["mae"])
- def train(self, epochs=100, batch_size=8, verbose=1):
- early_stopper = EarlyStopping(monitor="loss", patience=15)
- reduce_lr = ReduceLROnPlateau(
- monitor="loss", factor=0.2, verbose=0, patience=4, min_lr=1e-6
- )
- self.history = self.model.fit(
- self.pc_train_normalized,
- self.Y_train,
- epochs=epochs,
- verbose=verbose,
- batch_size=batch_size,
- callbacks=[reduce_lr, early_stopper],
- )
- return self.history
- def evaluate(self):
- Y_pred = self.model.predict(self.pc_test_normalized, verbose=0).flatten()
- # Inverse transform to original concentration scale
- Y_test_orig = np.array([self.loader.inverse_transform(y) for y in self.Y_test])
- Y_pred_orig = np.array([self.loader.inverse_transform(y) for y in Y_pred])
- # Calculate metrics: MSE on normalized Y, R2 on original scale
- mse = mean_squared_error(self.Y_test, Y_pred)
- r2 = r2_score(Y_test_orig, Y_pred_orig)
- print(f"\nTest MSE (normalized): {mse:.6f}")
- print(f"Test R2 (original scale): {r2:.6f}")
- return Y_pred, Y_test_orig, Y_pred_orig, mse, r2
- def evaluate_on_all_data(self):
- all_X, all_Y, all_Y_reg = self.loader.get_all_data()
- pc_all = np.matmul(all_X, self.pca_components.T)
- pc_all_normalized = (pc_all - self.pc_min) / (self.pc_max - self.pc_min)
- Y_pred = self.model.predict(pc_all_normalized, verbose=0).flatten()
- # Inverse transform to original concentration scale
- Y_orig = np.array([self.loader.inverse_transform(y) for y in all_Y_reg])
- Y_pred_orig = np.array([self.loader.inverse_transform(y) for y in Y_pred])
- # Calculate metrics: MSE on normalized Y, R2 on original scale
- mse = mean_squared_error(all_Y_reg, Y_pred)
- r2 = r2_score(Y_orig, Y_pred_orig)
- print(f"\nAll Data MSE (normalized): {mse:.6f}")
- print(f"All Data R2 (original scale): {r2:.6f}")
- return Y_pred, Y_orig, Y_pred_orig, mse, r2
- def visualize(self, mse, r2):
- Y_pred = self.model.predict(self.pc_test_normalized, verbose=0).flatten()
- Y_test_orig = np.array([self.loader.inverse_transform(y) for y in self.Y_test])
- Y_pred_orig = np.array([self.loader.inverse_transform(y) for y in Y_pred])
- # Get concentration list for x-axis
- c_list = self.loader.selected_concentrations
- x_ax = np.arange(np.min(c_list), np.max(c_list) + 1)
- plt.figure(figsize=(10, 8))
- plt.plot(x_ax, x_ax, "b", linewidth=2)
- plt.scatter(
- Y_test_orig, Y_pred_orig, marker="d", color="green", alpha=0.8, s=60
- )
- plt.legend(["Ideal fit", "Model Prediction"], fontsize=16)
- # Create tick labels
- ticks = []
- for c in x_ax:
- ticks.append("$10^{" + str(int(c)) + "}$")
- plt.xticks(x_ax, ticks, fontsize=12)
- plt.yticks(x_ax, ticks, fontsize=12)
- plt.title("mse={:.4f}, r2={:.4f}".format(mse, r2))
- return plt.gcf()
- def save_model(self, save_path):
- self.model.save(save_path)
- # np.save(save_path.replace('.h5', '_pca.npy'), self.pca_components)
- print(f"Model saved to {save_path}")
- if __name__ == "__main__":
- from dataloader import SpectraDataLoader
- loader = SpectraDataLoader(
- data_dir="./data/dopamine_pbs",
- split_by_batch=False,
- concentration_list=[0, -11, -10, -9, -8, -7, -6],
- norm_type="anchor",
- test_ratio=0.25,
- )
- trainer = SpectraTrainer(loader=loader, n_pca=8)
- print("\nTraining model...")
- trainer.train(epochs=100, batch_size=8, verbose=1)
- print("\nEvaluating model...")
- Y_pred, Y_test_orig, Y_pred_orig, mse, r2 = trainer.evaluate()
- print("\nEvaluating on all data...")
- _ = trainer.evaluate_on_all_data()
- print("\nVisualizing results...")
- fig = trainer.visualize(mse, r2)
- plt.show()
trainer.py at commit 8e7e734, no license · at the source
Overview
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
8e7e7341813d65aca7de5be805cc4ddecc70dc76, 5 April 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
7 files
- .ipynb_checkpoints/
dataloader-checkpoint.py , Python, 212 lines - .ipynb_checkpoints/
run-checkpoint.py , Python, 276 lines - .ipynb_checkpoints/
trainer-checkpoint.py , Python, 166 lines - dataloader.py, Python, 212 lines
- run.py, Python, 276 lines, 1 match
- trainer.py, Python, 166 lines, 2 matches
- README.md, Text, 27 lines
Zenodo 19430063
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
4 files
- dataloader.py, Python, 212 lines
- run.py, Python, 276 lines
- trainer.py, Python, 166 lines
- README.md, Text, 27 lines
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:
- it points to the authors' code: QizhouW/
Hardware-accelerated-Dop amine-Sensing
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&
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\&
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {7176},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/
url = {https://
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&
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/
VL - 17
IS - 1
SP - 7176
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Towards real-time additive-free dopamine detection at 10&
"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":
"volume": "17",
"issue": "1",
"page": "7176",
"DOI": "10.1038/
"PMID": "42243130",
"PMCID": "PMC13396668",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"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 diseaseIn 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 reviewIn 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: TheranosticsIn 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 communicationsIn 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 measurementIn 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: eLifeIn 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 neurologyIn 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: NatureIn 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 protocolsIn 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 biologyIn 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 9 scripts, and 3 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:1031d6c6c7523afc…
Add the badge to the code's README
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 -->
[](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:endHTML
<!-- 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.
