Towards real-time additive-free dopamine detection at 10<sup>-8</sup> mM with hardware accelerated platform integrated on camera.
The 3 matches
- [1] § Results ↔ trainer.py, lines 11–139 · score 0.61 · R2 score, PCA components, ideal, monitoring, fitted, variance
- [2] § Results ↔ trainer.py, lines 11–139 · score 0.55 · square error, R2 score, fitted, regression, components, model
- [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
- 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.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 : JADIn 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 reportsIn 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 oneIn 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 biomedicineIn 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 onlineIn 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 dataIn 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 methodsIn 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 reportsIn 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 scenesJournal: n/aIn 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 &
lt;i& gt;m/ z& lt;/ i& gt; mapping and exploration. Journal: Science advancesIn 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.
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:926f6412d7c16d2b…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
