iMOSS: an integrated open-source tail suspension test platform for high-resolution immobility scoring and synchronization with neural activity.
The 7 matches
- [1] § Materials, equipment, and methods › Threshold optimization using machine learning ↔ Data_Analysis/Machine Learning/ZY_ML_V5.py, lines 84–118 · score 0.94 · Random Forest regression, RandomizedSearchCV, n_estimators, random_state, machine learning, absolute error
- [2] § Materials, equipment, and methods › Code accessibility ↔ Data_Analysis/zy_install_libraries_version.py, lines 87–123 · score 0.72 · PyExcelerate, installation, OpenCV, Pandas, Pillow, libraries
- [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–369 · score 0.71 · band pass, separating pre, post start period, refined start, subtraction, raw
- [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–309 · score 0.68 · smallest rolling standard, post start period, deviation, baseline, filtering, window
- [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–443 · score 0.67 · smoothed signals, Provisional start, period threshold, post start period, raw, baseline
- [6] § Results › iMOSS-AS: a sensor-based automated immobility scoring platform ↔ Data_Analysis/Machine Learning/ZY_ML_V5.py, lines 84–118 · score 0.62 · Random Forest regressor, absolute error, prediction, MAE, model, scoring
- [7] § Results › iMOSS-AS: a sensor-based automated immobility scoring platform ↔ Data_Analysis/Machine Learning/ZY_ML_V5.py, lines 171–190 · score 0.56 · global best threshold, absolute error, Machine learning, MAE, mouse
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 · 195 lines · 6.2 KB · MIT · 3 matches
- # -*- coding: utf-8 -*-
- """
- Spyder Editor
- This is a temporary script file.
- """
- import os
- import pandas as pd
- import numpy as np
- from sklearn.model_selection import train_test_split, GroupKFold, RandomizedSearchCV
- from sklearn.ensemble import RandomForestRegressor
- from sklearn.metrics import mean_absolute_error
- from sklearn.base import clone
- # ===============================
- # 1. Load data
- # ===============================
- excel_file = r"C:\Users\yez4\Box\NIDA works\Projects\Manuscript for tail suspension system\202500328\ML_threshold\immobility_threshold_data.xlsx"
- sheet_name = "Sheet1"
- file_path = os.path.dirname(excel_file)
- output_path = os.path.join(file_path,'Output')
- df = pd.read_excel(excel_file, sheet_name=sheet_name)
- # Features and target
- X = df[["Threshold", "Auto_Time"]]
- y = df["Manual_Time"]
- groups = df["Mouse"]
- # ===============================
- # 2. Train-test split by mouse
- # ===============================
- mice = df["Mouse"].unique()
- train_mice, test_mice = train_test_split(mice, test_size=0.25, random_state=42)
- train_df = df[df["Mouse"].isin(train_mice)].copy()
- test_df = df[df["Mouse"].isin(test_mice)].copy()
- X_train = train_df[["Threshold", "Auto_Time"]]
- y_train = train_df["Manual_Time"]
- g_train = train_df["Mouse"]
- X_test = test_df[["Threshold", "Auto_Time"]]
- y_test = test_df["Manual_Time"]
- print(f"Train mice: {len(train_mice)}, Test mice: {len(test_mice)}")
- print(f"Train rows: {len(train_df)}, Test rows: {len(test_df)}")
- # ===============================
- # 3. Baseline model
- # ===============================
- baseline_model = RandomForestRegressor(
- n_estimators=200,
- random_state=42
- )
- baseline_model.fit(X_train, y_train)
- baseline_test_pred = baseline_model.predict(X_test)
- baseline_test_mae = mean_absolute_error(y_test, baseline_test_pred)
- # Grouped CV on training mice only
- n_splits = min(5, len(np.unique(g_train)))
- if n_splits < 2:
- raise ValueError("Not enough training mice for cross-validation.")
- gkf = GroupKFold(n_splits=n_splits)
- baseline_cv_maes = []
- for tr_idx, val_idx in gkf.split(X_train, y_train, groups=g_train):
- X_tr, X_val = X_train.iloc[tr_idx], X_train.iloc[val_idx]
- y_tr, y_val = y_train.iloc[tr_idx], y_train.iloc[val_idx]
- m = clone(baseline_model)
- m.fit(X_tr, y_tr)
- pred = m.predict(X_val)
- baseline_cv_maes.append(mean_absolute_error(y_val, pred))
- baseline_cv_mae = float(np.mean(baseline_cv_maes))
- print(f"Baseline RF | CV MAE (train only): {baseline_cv_mae:.3f} | Test MAE: {baseline_test_mae:.3f}")
- # ===============================
- # 4. Tuned model
- # Tune ONLY on training mice
- # ===============================
- param_dist = {
- "n_estimators": [100, 150, 200, 250, 300, 400],
- "max_depth": [None, 4, 6, 8, 10, 12, 16, 20],
- "min_samples_split": [2, 4, 6, 8, 10],
- "min_samples_leaf": [1, 2, 3, 4, 5],
- "max_features": ["sqrt", "log2", 1.0, 0.7, 0.5],
- "bootstrap": [True],
- "max_samples": [0.7, 0.8, 0.9, 1.0],
- }
- search = RandomizedSearchCV(
- estimator=RandomForestRegressor(random_state=42),
- param_distributions=param_dist,
- n_iter=25,
- scoring="neg_mean_absolute_error",
- cv=gkf,
- random_state=42,
- n_jobs=-1,
- refit=True
- )
- search.fit(X_train, y_train, groups=g_train)
- tuned_model = search.best_estimator_
- tuned_cv_mae = -search.best_score_
- tuned_test_pred = tuned_model.predict(X_test)
- tuned_test_mae = mean_absolute_error(y_test, tuned_test_pred)
- print(f"Tuned RF | CV MAE (train only): {tuned_cv_mae:.3f} | Test MAE: {tuned_test_mae:.3f}")
- print("Best tuned params:", search.best_params_)
- # ===============================
- # 5. Choose final model using CV only
- # Do NOT use test MAE for selection
- # ===============================
- if tuned_cv_mae < baseline_cv_mae:
- best_model = tuned_model
- best_name = "Tuned RF"
- best_cv_mae = tuned_cv_mae
- else:
- best_model = baseline_model
- best_name = "Baseline RF"
- best_cv_mae = baseline_cv_mae
- print(f"Selected model by training CV: {best_name} (CV MAE = {best_cv_mae:.3f})")
- # ===============================
- # 6. Final test evaluation once
- # ===============================
- final_pred = best_model.predict(X_test)
- final_test_mae = mean_absolute_error(y_test, final_pred)
- print(f"Final model: {best_name} | Final test MAE: {final_test_mae:.3f}")
- # Optional: save chosen model
- # import joblib
- # joblib.dump(best_model, os.path.join(os.path.dirname(excel_file), "best_model.joblib"))
- # ===============================
- # 7. Individual best threshold
- # ===============================
- search_space = np.linspace(df['Threshold'].min(), df['Threshold'].max(), 1000)
- results = []
- for mouse in df['Mouse'].unique():
- sub = df[df['Mouse'] == mouse]
- manual = sub['Manual_Time'].iloc[0]
- preds = []
- for t in search_space:
- auto_est = np.interp(t, sub['Threshold'], sub['Auto_Time'])
- X_new = pd.DataFrame([[t, auto_est]], columns=['Threshold', 'Auto_Time'])
- pred = best_model.predict(X_new)[0]
- preds.append(pred)
- preds = np.array(preds)
- best_idx = np.argmin(np.abs(preds - manual))
- best_thresh = search_space[best_idx]
- best_pred = preds[best_idx]
- results.append([mouse, manual, best_thresh, best_pred])
- results_df = pd.DataFrame(results, columns=['Mouse', 'Manual', 'Best_Threshold', 'Predicted_Time'])
- print("\nIndividual best thresholds:")
- print(results_df)
- # ===============================
- # 8. Global best threshold
- # ===============================
- global_errors = []
- for t in search_space:
- preds, manuals = [], []
- for mouse in df['Mouse'].unique():
- sub = df[df['Mouse'] == mouse]
- manual = sub['Manual_Time'].iloc[0]
- auto_est = np.interp(t, sub['Threshold'], sub['Auto_Time'])
- X_new = pd.DataFrame([[t, auto_est]], columns=['Threshold', 'Auto_Time'])
- pred = best_model.predict(X_new)[0]
- preds.append(pred)
- manuals.append(manual)
- error = mean_absolute_error(manuals, preds)
- global_errors.append(error)
- best_idx = np.argmin(global_errors)
- global_best_thresh = search_space[best_idx]
- print(f"\nGlobal best threshold: {global_best_thresh:.3f}, MAE={global_errors[best_idx]:.3f}")
- # save results_df as csv
- csv_name = 'ML_result.csv'
- csv_path = os.path.join(output_path, csv_name)
- results_df.to_csv(csv_path, index=False)
ZY_ML_V5.py at commit 317da51, under MIT · at the source
Overview
- Behavioral Neuroscience Research Branch, Intramural Research Program, National Institute on Drug Abuse, National Institutes of Health, Baltimore, MD, United States
- Molecular Cardiology Research Institute, Tufts Medical Center, Boston, MA, United States
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/
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
317da515ee2a08f515d71e55039cec0213468c37, 10 June 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
15 files
- Data_Analysis/
Machine Learning/ — Python, 195 lines, 3 matchesZY_ML_V5.py - Data_Analysis/
iMOSS_AS/ — Python, 758 lines, 3 matchesArchive_V1/ zy_iMOSS_AS_20251119_cle an.py - Data_Analysis/
iMOSS_AS/ — Python, 248 linesArchive_V1/ zy_importer_lite_V4.py - Data_Analysis/
iMOSS_AS/ — Python, 25 linesArchive_V1/ zy_preset_mpl_v2.py - Data_Analysis/
iMOSS_AS/ — Python, 734 linesV2/ zy_iMOSS_AS_20260501_wit h_summary.py - Data_Analysis/
iMOSS_AS/ — Python, 189 linesV2/ zy_importer_lite_V5.py - Data_Analysis/
iMOSS_AS/ — Python, 25 linesV2/ zy_preset_mpl_v2.py - Data_Analysis/
iMOSS_MV/ — Python, 1,045 linesV1/ zy_iMOSS_MV_20251119.py - Data_Analysis/
iMOSS_MV/ — Python, 1,057 linesV1/ zy_iMOSS_MV_20260610_log ofree.py - Data_Analysis/
iMOSS_MV/ — Python, 1,065 linesV2/ zy_iMOSS_MV_withDuration .py - Data_Analysis/
iMOSS_MV/ — Python, 881 linesV3/ zy_iMOSS_MV_20260501.py - Data_Analysis/
logo_to_base64.py — Python, 51 lines - Data_Analysis/
zy_install_libraries_ver — Python, 123 lines, 1 matchsion.py - LICENSE — License, 21 lines
- README.md — Text, 323 lines
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://
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/
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://
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/
url = {https://
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/
VL - 20
SP - 1819512
SN - 1662-5153
PB - Frontiers Media SA
DO - 10.3389/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.3389/
"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":
"volume": "20",
"page": "1819512",
"DOI": "10.3389/
"PMID": "42182827",
"PMCID": "PMC13194518",
"ISSN": "1662-5153",
"publisher": "Frontiers Media SA",
"URL": "https://
"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: [code]
- Real-time closed-loop feedback system for mouse mesoscale cortical signal and movement controlJournal: eLifeIn common: OpenCV, Pillow, scikit-learn, 4 other tools, optical imaging (calcium, voltage, 2-photon)
- [2] doi:10.1016/j.isci.2026.116206 [code]
- Gut distension evokes rapid neural dynamics in vagal and hindbrain populations of larval zebrafish.Journal: iScienceIn common: OpenCV, Pillow, scikit-learn, 4 other tools, optical imaging (calcium, voltage, 2-photon)
- [3] doi:10.1002/advs.202510822 [code]
- How Neuromorphic Microstructures Control In Vitro Early-Stage Neuronal Outgrowth.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: OpenCV, Pillow, scikit-learn, 4 other tools, optical imaging (calcium, voltage, 2-photon)
- [4] doi:10.1038/s41467-026-72710-3 [code]
- A modular multi-color fluorescence microscope for simultaneous tracking of cellular activity and behavior.Journal: Nature communicationsIn common: OpenCV, Pillow, scikit-learn, 4 other tools, optical imaging (calcium, voltage, 2-photon)
- [5] doi:10.1371/journal.pcbi.1013441 [code]
- Large vision model framework for automated C. elegans analysis: From static morphometry to dynamic neural activity.Journal: PLoS computational biologyIn common: OpenCV, Pillow, pandas, 3 other tools, optical imaging (calcium, voltage, 2-photon), methods / tools
- [6] doi:10.1364/boe.600665 [code]
- NeuroSeg-MF: robust neuron segmentation in two-photon Ca&
lt;sup& gt;2+& lt;/ sup& gt; imaging using multi-feature fusion and detection-guided SAM. Journal: Biomedical optics expressIn common: OpenCV, Pillow, pandas, 3 other tools, optical imaging (calcium, voltage, 2-photon), methods / tools - [7] 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: OpenCV, Pillow, scikit-learn, 4 other tools, methods / tools - [8] doi:10.1038/s41598-026-57519-w [code]
- Automated segmentation of neurons and spinal cord structures in immunofluorescence images using SpineDL.Journal: Scientific reportsIn common: OpenCV, Pillow, scikit-learn, 4 other tools, methods / tools
- [9] doi:10.21203/rs.3.rs-9676637/v1 [code]
- A Comprehensive Benchmarking of Spatial Deconvolution and Domain Detection Methods across Diverse Tissues and Spatial Transcriptomic TechnologiesJournal: Research Square (preprint)In common: OpenCV, Pillow, scikit-learn, 4 other tools, methods / tools
- [10] doi:10.1016/j.isci.2026.116168 [code]
- See the small lesions: Frequency-guided spatial debiasing GAN for multimodal medical image fusion.Journal: iScienceIn common: OpenCV, Pillow, scikit-learn, 4 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: 1 repository of the authors' code, each at its verified commit and with its license, 13 scripts, and 7 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:be4fc7cac2440656…
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.
