OSCR

iMOSS: an integrated open-source tail suspension test platform for high-resolution immobility scoring and synchronization with neural activity.

Code ↔ Paper

7 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 7 matches
  1. [1] § Materials, equipment, and methods › Threshold optimization using machine learning ↔ Data_Analysis/Machine Learning/ZY_ML_V5.py, lines 84 to 118 · score 0.94 · Random Forest regression, RandomizedSearchCV, n_estimators, random_state, machine learning, absolute error · Report a mismatch
  2. [2] § Materials, equipment, and methods › Code accessibility ↔ Data_Analysis/zy_install_libraries_version.py, lines 87 to 123 · score 0.72 · PyExcelerate, installation, OpenCV, Pandas, Pillow, libraries · Report a mismatch
  3. [3] § Results › iMOSS-AS: a sensor-based automated immobility scoring platform ↔ Data_Analysis/iMOSS_AS/Archive_V1/zy_iMOSS_AS_20251119_clean.py, lines 311 to 369 · score 0.71 · band pass, separating pre, post start period, refined start, subtraction, raw · Report a mismatch
  4. [4] § Results › iMOSS-AS: a sensor-based automated immobility scoring platform ↔ Data_Analysis/iMOSS_AS/Archive_V1/zy_iMOSS_AS_20251119_clean.py, lines 259 to 309 · score 0.68 · smallest rolling standard, post start period, deviation, baseline, filtering, window · Report a mismatch
  5. [5] § Results › iMOSS-AS: a sensor-based automated immobility scoring platform ↔ Data_Analysis/iMOSS_AS/Archive_V1/zy_iMOSS_AS_20251119_clean.py, lines 371 to 443 · score 0.67 · smoothed signals, Provisional start, period threshold, post start period, raw, baseline · Report a mismatch
  6. [6] § Results › iMOSS-AS: a sensor-based automated immobility scoring platform ↔ Data_Analysis/Machine Learning/ZY_ML_V5.py, lines 84 to 118 · score 0.62 · Random Forest regressor, absolute error, prediction, MAE, model, scoring · Report a mismatch
  7. [7] § Results › iMOSS-AS: a sensor-based automated immobility scoring platform ↔ Data_Analysis/Machine Learning/ZY_ML_V5.py, lines 171 to 190 · score 0.56 · global best threshold, absolute error, Machine learning, MAE, mouse · 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 · 195 lines · 6.2 KB · MIT · 3 matches

  1. # -*- coding: utf-8 -*-
  2. """
  3. Spyder Editor
  4. This is a temporary script file.
  5. """
  6. import os
  7. import pandas as pd
  8. import numpy as np
  9. from sklearn.model_selection import train_test_split, GroupKFold, RandomizedSearchCV
  10. from sklearn.ensemble import RandomForestRegressor
  11. from sklearn.metrics import mean_absolute_error
  12. from sklearn.base import clone
  13. # ===============================
  14. # 1. Load data
  15. # ===============================
  16. excel_file = r"C:\Users\yez4\Box\NIDA works\Projects\Manuscript for tail suspension system\202500328\ML_threshold\immobility_threshold_data.xlsx"
  17. sheet_name = "Sheet1"
  18. file_path = os.path.dirname(excel_file)
  19. output_path = os.path.join(file_path,'Output')
  20. df = pd.read_excel(excel_file, sheet_name=sheet_name)
  21. # Features and target
  22. X = df[["Threshold", "Auto_Time"]]
  23. y = df["Manual_Time"]
  24. groups = df["Mouse"]
  25. # ===============================
  26. # 2. Train-test split by mouse
  27. # ===============================
  28. mice = df["Mouse"].unique()
  29. train_mice, test_mice = train_test_split(mice, test_size=0.25, random_state=42)
  30. train_df = df[df["Mouse"].isin(train_mice)].copy()
  31. test_df = df[df["Mouse"].isin(test_mice)].copy()
  32. X_train = train_df[["Threshold", "Auto_Time"]]
  33. y_train = train_df["Manual_Time"]
  34. g_train = train_df["Mouse"]
  35. X_test = test_df[["Threshold", "Auto_Time"]]
  36. y_test = test_df["Manual_Time"]
  37. print(f"Train mice: {len(train_mice)}, Test mice: {len(test_mice)}")
  38. print(f"Train rows: {len(train_df)}, Test rows: {len(test_df)}")
  39. # ===============================
  40. # 3. Baseline model
  41. # ===============================
  42. baseline_model = RandomForestRegressor(
  43. n_estimators=200,
  44. random_state=42
  45. )
  46. baseline_model.fit(X_train, y_train)
  47. baseline_test_pred = baseline_model.predict(X_test)
  48. baseline_test_mae = mean_absolute_error(y_test, baseline_test_pred)
  49. # Grouped CV on training mice only
  50. n_splits = min(5, len(np.unique(g_train)))
  51. if n_splits < 2:
  52. raise ValueError("Not enough training mice for cross-validation.")
  53. gkf = GroupKFold(n_splits=n_splits)
  54. baseline_cv_maes = []
  55. for tr_idx, val_idx in gkf.split(X_train, y_train, groups=g_train):
  56. X_tr, X_val = X_train.iloc[tr_idx], X_train.iloc[val_idx]
  57. y_tr, y_val = y_train.iloc[tr_idx], y_train.iloc[val_idx]
  58. m = clone(baseline_model)
  59. m.fit(X_tr, y_tr)
  60. pred = m.predict(X_val)
  61. baseline_cv_maes.append(mean_absolute_error(y_val, pred))
  62. baseline_cv_mae = float(np.mean(baseline_cv_maes))
  63. print(f"Baseline RF | CV MAE (train only): {baseline_cv_mae:.3f} | Test MAE: {baseline_test_mae:.3f}")
  64. # ===============================
  65. # 4. Tuned model
  66. # Tune ONLY on training mice
  67. # ===============================
  68. param_dist = {
  69. "n_estimators": [100, 150, 200, 250, 300, 400],
  70. "max_depth": [None, 4, 6, 8, 10, 12, 16, 20],
  71. "min_samples_split": [2, 4, 6, 8, 10],
  72. "min_samples_leaf": [1, 2, 3, 4, 5],
  73. "max_features": ["sqrt", "log2", 1.0, 0.7, 0.5],
  74. "bootstrap": [True],
  75. "max_samples": [0.7, 0.8, 0.9, 1.0],
  76. }
  77. search = RandomizedSearchCV(
  78. estimator=RandomForestRegressor(random_state=42),
  79. param_distributions=param_dist,
  80. n_iter=25,
  81. scoring="neg_mean_absolute_error",
  82. cv=gkf,
  83. random_state=42,
  84. n_jobs=-1,
  85. refit=True
  86. )
  87. search.fit(X_train, y_train, groups=g_train)
  88. tuned_model = search.best_estimator_
  89. tuned_cv_mae = -search.best_score_
  90. tuned_test_pred = tuned_model.predict(X_test)
  91. tuned_test_mae = mean_absolute_error(y_test, tuned_test_pred)
  92. print(f"Tuned RF | CV MAE (train only): {tuned_cv_mae:.3f} | Test MAE: {tuned_test_mae:.3f}")
  93. print("Best tuned params:", search.best_params_)
  94. # ===============================
  95. # 5. Choose final model using CV only
  96. # Do NOT use test MAE for selection
  97. # ===============================
  98. if tuned_cv_mae < baseline_cv_mae:
  99. best_model = tuned_model
  100. best_name = "Tuned RF"
  101. best_cv_mae = tuned_cv_mae
  102. else:
  103. best_model = baseline_model
  104. best_name = "Baseline RF"
  105. best_cv_mae = baseline_cv_mae
  106. print(f"Selected model by training CV: {best_name} (CV MAE = {best_cv_mae:.3f})")
  107. # ===============================
  108. # 6. Final test evaluation once
  109. # ===============================
  110. final_pred = best_model.predict(X_test)
  111. final_test_mae = mean_absolute_error(y_test, final_pred)
  112. print(f"Final model: {best_name} | Final test MAE: {final_test_mae:.3f}")
  113. # Optional: save chosen model
  114. # import joblib
  115. # joblib.dump(best_model, os.path.join(os.path.dirname(excel_file), "best_model.joblib"))
  116. # ===============================
  117. # 7. Individual best threshold
  118. # ===============================
  119. search_space = np.linspace(df['Threshold'].min(), df['Threshold'].max(), 1000)
  120. results = []
  121. for mouse in df['Mouse'].unique():
  122. sub = df[df['Mouse'] == mouse]
  123. manual = sub['Manual_Time'].iloc[0]
  124. preds = []
  125. for t in search_space:
  126. auto_est = np.interp(t, sub['Threshold'], sub['Auto_Time'])
  127. X_new = pd.DataFrame([[t, auto_est]], columns=['Threshold', 'Auto_Time'])
  128. pred = best_model.predict(X_new)[0]
  129. preds.append(pred)
  130. preds = np.array(preds)
  131. best_idx = np.argmin(np.abs(preds - manual))
  132. best_thresh = search_space[best_idx]
  133. best_pred = preds[best_idx]
  134. results.append([mouse, manual, best_thresh, best_pred])
  135. results_df = pd.DataFrame(results, columns=['Mouse', 'Manual', 'Best_Threshold', 'Predicted_Time'])
  136. print("\nIndividual best thresholds:")
  137. print(results_df)
  138. # ===============================
  139. # 8. Global best threshold
  140. # ===============================
  141. global_errors = []
  142. for t in search_space:
  143. preds, manuals = [], []
  144. for mouse in df['Mouse'].unique():
  145. sub = df[df['Mouse'] == mouse]
  146. manual = sub['Manual_Time'].iloc[0]
  147. auto_est = np.interp(t, sub['Threshold'], sub['Auto_Time'])
  148. X_new = pd.DataFrame([[t, auto_est]], columns=['Threshold', 'Auto_Time'])
  149. pred = best_model.predict(X_new)[0]
  150. preds.append(pred)
  151. manuals.append(manual)
  152. error = mean_absolute_error(manuals, preds)
  153. global_errors.append(error)
  154. best_idx = np.argmin(global_errors)
  155. global_best_thresh = search_space[best_idx]
  156. print(f"\nGlobal best threshold: {global_best_thresh:.3f}, MAE={global_errors[best_idx]:.3f}")
  157. # save results_df as csv
  158. csv_name = 'ML_result.csv'
  159. csv_path = os.path.join(output_path, csv_name)
  160. results_df.to_csv(csv_path, index=False)

ZY_ML_V5.py at commit 317da51, under MIT · at the source

Overview

Authors: Zengyou Ye1, Xia Min1, Sarah T. Johnson1, Xuehong Cao2, Satoshi Ikemoto1
  1. Behavioral Neuroscience Research Branch, Intramural Research Program, National Institute on Drug Abuse, National Institutes of Health, Baltimore, MD, United States
  2. Molecular Cardiology Research Institute, Tufts Medical Center, Boston, MA, United States
Institutions: National Institutes of Health (United States); National Institute on Drug Abuse (United States); Tufts Medical Center (United States)
Journal: Frontiers in behavioral neuroscience, volume 20, article 1819512
Dates: received 27 February 2026; accepted 20 April 2026; published online 8 May 2026
Type: Methods article · Language: English
License: CC BY
Identifiers: DOI 10.3389/fnbeh.2026.1819512 · PMID 42182827 · PMCID PMC13194518 · OpenAlex W7160546135
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Methods: Connectivity, Statistics, Machine learning, Preprocessing, Single-unit activity, calcium imaging
Keywords: behavioral neuroscience, fiber photometry, immobility scoring, open-source platform, tail suspension test
Topic: Neurotransmitter Receptor Influence on Behavior (Cellular and Molecular Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 8 references in the paper

Abstract

The tail suspension test (TST) is widely used to assess stress-coping behavior in rodents, characterized by alternating periods of active (struggling) and passive (immobile) responses. Immobility in the TST is interpreted as behavioral despair and serves as a key measure for screening antidepressant compounds. Traditional manual scoring is labor-intensive and temporally imprecise, while existing automated systems often misclassify behaviors and have not shown the capacity to integrate behavioral data with neural recording methods. Here, we improved upon the traditional TST with our new developed iMOSS (Immobility/Mobility Optimized Scoring System)—two open-source, low-cost, and scalable tools for high-resolution quantification of mobility and immobility: (1) iMOSS-MV, a video-based frame-by-frame manual-scoring software instrument designed to precisely annotate the exact onset frame for each binary event, and (2) iMOSS-AS, a sensor-based automated instrument detecting immobility/mobility bouts from the sensor-signal using a machine-learning optimized detection threshold. The output from iMOSS-AS closely matched that from iMOSS-MV and outperformed other publicly available tools. Moreover, both systems reliably detected changes in mobility and immobility induced by imipramine treatment, demonstrating sensitivity to pharmacological manipulation. Finally, both iMOSS tools readily integrated with neural data, as shown by simultaneous analysis of medial septal glutamatergic calcium activity via fiber photometry. Thus, either iMOSS-MV or iMOSS-AS alone offers an efficient, user-friendly, and bias-minimized platform for high-throughput behavioral analysis, enabling seamless integration of behavioral and neural data in systems neuroscience research.

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

addy9908/iMOSS

License: MIT
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 317da515ee2a08f515d71e55039cec0213468c37, 10 June 2026
Languages: Python (13)
Size: 94 files, 13 scripts
Software Heritage: not archived
Found in: “Code accessibility”
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (7 files), pandas (7 files), Pillow (5 files), Matplotlib (4 files), OpenCV (4 files), SciPy (2 files), scikit-learn (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
15 files

Code accessibility

The iMOSS-MV and iMOSS-AS were developed in Python and leverages widely used libraries including OpenCV, Tkinter, Numpy, Pandas, Pillow, Scipy, and PyExcelerate. All the codes will be freely available online at https://github.com/addy9908/iMOSS under an MIT license, along with user documentation detailing the installation process. Additionally, the full Python source code is provided in the Supplementary material. Future updates to the code will be available through the link provided above.

Reproduced under the paper's license (CC BY), from the paper cited above.

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;
  • 13 scripts, each with its path and the digest of its content;
  • 7 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 datasets presented in this study can be found in online repositories. The names of the repository/repositories and accession number(s) can be found at: https://github.com/addy9908/iMOSS.

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, 28 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 5 authors, 5 keywords, 8 references.

Cite

This paper

Ye, Z., Min, X., Johnson, S. T., Cao, X., & Ikemoto, S. (2026). iMOSS: an integrated open-source tail suspension test platform for high-resolution immobility scoring and synchronization with neural activity. Frontiers in behavioral neuroscience, 20, 1819512. https://doi.org/10.3389/fnbeh.2026.1819512

BibTeX

@article{ye2026imoss,
author = {Ye, Zengyou and Min, Xia and Johnson, Sarah T. and Cao, Xuehong and Ikemoto, Satoshi},
title = {{iMOSS: an integrated open-source tail suspension test platform for high-resolution immobility scoring and synchronization with neural activity}},
journal = {Frontiers in behavioral neuroscience},
year = {2026},
month = may,
volume = {20},
pages = {1819512},
publisher = {Frontiers Media SA},
issn = {1662-5153},
doi = {10.3389/fnbeh.2026.1819512},
url = {https://doi.org/10.3389/fnbeh.2026.1819512},
pmid = {42182827},
pmcid = {PMC13194518}
}

RIS

TY - JOUR
AU - Ye, Zengyou
AU - Min, Xia
AU - Johnson, Sarah T.
AU - Cao, Xuehong
AU - Ikemoto, Satoshi
TI - iMOSS: an integrated open-source tail suspension test platform for high-resolution immobility scoring and synchronization with neural activity
T2 - Frontiers in behavioral neuroscience
J2 - Front Behav Neurosci
PY - 2026
DA - 2026/05/08
VL - 20
SP - 1819512
SN - 1662-5153
PB - Frontiers Media SA
DO - 10.3389/fnbeh.2026.1819512
UR - https://doi.org/10.3389/fnbeh.2026.1819512
LA - en
ER -

CSL-JSON

{
"id": "10.3389/fnbeh.2026.1819512",
"type": "article-journal",
"title": "iMOSS: an integrated open-source tail suspension test platform for high-resolution immobility scoring and synchronization with neural activity",
"container-title": "Frontiers in behavioral neuroscience",
"author": [
{
"family": "Ye",
"given": "Zengyou"
},
{
"family": "Min",
"given": "Xia"
},
{
"family": "Johnson",
"given": "Sarah T."
},
{
"family": "Cao",
"given": "Xuehong"
},
{
"family": "Ikemoto",
"given": "Satoshi"
}
],
"container-title-short": "Front Behav Neurosci",
"volume": "20",
"page": "1819512",
"DOI": "10.3389/fnbeh.2026.1819512",
"PMID": "42182827",
"PMCID": "PMC13194518",
"ISSN": "1662-5153",
"publisher": "Frontiers Media SA",
"URL": "https://doi.org/10.3389/fnbeh.2026.1819512",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
8
]
]
}
}

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.7554/elife.78116 [code]
The rapid developmental rise of somatic inhibition disengages hippocampal dynamics from self-motion.
Journal: eLife
In common: OpenCV, Pillow, scikit-learn, 4 other tools, optical imaging (calcium, voltage, 2-photon), 1 reference
[2] doi:10.7554/elife.79305 [code]
Open-source tools for behavioral video analysis: Setup, methods, and best practices.
Journal: eLife
In common: OpenCV, Pillow, scikit-learn, 4 other tools, methods / tools, 1 reference
[3] doi:10.7554/elife.70661 [code]
Minian, an open-source miniscope analysis pipeline.
Journal: eLife
In common: OpenCV, scikit-learn, pandas, 3 other tools, optical imaging (calcium, voltage, 2-photon), methods / tools, 1 reference
[4] doi:10.1016/j.crmeth.2026.101421 [code]
EthoPy provides an accessible platform for reproducible behavioral neuroscience.
Journal: Cell reports methods
In common: OpenCV, scikit-learn, pandas, 3 other tools, methods / tools, 1 reference
[5] doi:10.3390/s25237163 [code]
Advancing Mobile Neuroscience: A Novel Wearable Backpack for Multi-Sensor Research in Urban Environments.
Journal: Sensors (Basel, Switzerland)
In common: OpenCV, scikit-learn, pandas, 3 other tools, methods / tools, 1 reference
[6] doi:10.1038/s41598-025-14693-7 [code]
RpiBeh offers a versatile open source solution for rodent behavior tracking and closed loop interventions.
Journal: Scientific reports
In common: OpenCV, Pillow, pandas, 2 other tools, methods / tools, 1 reference
[7] doi:10.1038/s41467-025-67133-5 [code]
Activation of hypothalamic-pontine-spinal pathway promotes locomotor initiation and functional recovery after spinal cord injury in mice.
Journal: Nature communications
In common: Pillow, scikit-learn, pandas, 3 other tools, 1 reference
[8] doi:10.1038/s41467-026-74823-1 [code]
Cerebellar activity is triggered by reach endpoint during learning of a complex locomotor task.
Journal: Nature communications
In common: OpenCV, scikit-learn, pandas, 3 other tools, 1 reference
[9] doi:10.1016/j.xpro.2025.104186 [code]
Covalent anchoring of tethered ligands to chemogenetic handles for targeted in vivo neuropharmacology.
Journal: STAR protocols
In common: OpenCV, scikit-learn, pandas, 3 other tools, 1 reference
[10] doi:10.1038/s41586-024-08548-w [code]
Learning produces an orthogonalized state machine in the hippocampus.
Journal: Nature
In common: OpenCV, scikit-learn, pandas, 3 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.

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.3389/fnbeh.2026.1819512.svg)](https://openscicode.org/badge/doi/10.3389/fnbeh.2026.1819512)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.3389/fnbeh.2026.1819512.svg
   :target: https://openscicode.org/badge/doi/10.3389/fnbeh.2026.1819512
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.3389/fnbeh.2026.1819512"><img src="https://openscicode.org/badge/doi/10.3389/fnbeh.2026.1819512.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.