Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice.
The 5 matches
- [1] § Materials and Methods › Synchronization across devices › Pupillometry ↔ PupilTracking/ResNetModel/notebooks/Training.ipynb, lines 106–166 · score 0.71 · training loss, validation loss, training epoch, model, accuracy, class
- [2] § Materials and Methods › Synchronization across devices › Pupillometry ↔ PupilTracking/ResNetModel/notebooks/Predictions.ipynb, lines 42–96 · score 0.70 · ResNet model, occluded eye, open eye, predict, class, pupil
- [3] § Materials and Methods › Freely moving operant conditioning visual discrimination task › Freely moving luminance discrimination task ↔ BehavioralTasks/CirclesDiscrimination/TaskCode/Circles_Discrimination_vGitHub.m, lines 349–461 · score 0.65 · correct reject, trial initiation, alarm, hit, probability, consecutive
- [4] § Materials and Methods › Closed-loop two-choice visual discrimination task › Performance and side-bias analysis ↔ BehavioralTasks/GratingDiscrimination2AC/DataOut/dataStructGenerator.m, lines 299–371 · score 0.53 · reward zone, licked left, incorrectly, grating, mouse
- [5] § Materials and Methods › Freely moving operant conditioning visual discrimination task › Acclimation to task environment ↔ BehavioralTasks/CirclesDiscrimination/DataOut/DataStructGenerator.m, lines 38–118 · score 0.53 · white circles, mouse licked, touching, transitioned, water, stimulus
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
Jupyter notebook · 166 lines · 5.4 KB · BSD-3-Clause · 1 match
- # %%
- import torch
- import argparse
- import torch.nn as nn
- import torch.optim as optim
- import time
- from tqdm.auto import tqdm
- from google.colab import drive
- drive.mount('/content/drive')
- import sys
- sys.path.append('/content/drive/MyDrive/ResNetModel/src')
- from model import build_model
- from findmydatasets import get_datasets, get_data_loaders
- from utils import save_model, save_plots
- # %%
- seed = 45
- torch.manual_seed(seed)
- torch.cuda.manual_seed(seed)
- torch.backends.cudnn.deterministic = True
- torch.backends.cudnn.benchmark = True
- # %%
- from google.colab import drive
- drive.mount('/content/drive')
- # %%
- # Construct the argument parser.
- parser = argparse.ArgumentParser()
- parser.add_argument(
- '-e', '--epochs', type=int, default=35,
- help='Number of epochs to train our network for'
- )
- parser.add_argument(
- '-lr', '--learning-rate', type=float,
- dest='learning_rate', default=0.001,
- help='Learning rate for training the model'
- )
- args = vars(parser.parse_args([]))
- # %%
- # Training function.
- def train(model, trainloader, optimizer, criterion):
- model.train()
- print('Training')
- train_running_loss = 0.0
- train_running_correct = 0
- counter = 0
- for i, data in tqdm(enumerate(trainloader), total=len(trainloader)):
- counter += 1
- image, labels = data
- image = image.to(device)
- labels = labels.to(device)
- optimizer.zero_grad()
- # Forward pass.
- outputs = model(image)
- # Calculate the loss.
- loss = criterion(outputs, labels)
- train_running_loss += loss.item()
- # Calculate the accuracy.
- _, preds = torch.max(outputs.data, 1)
- train_running_correct += (preds == labels).sum().item()
- # Backpropagation.
- loss.backward()
- # Update the weights.
- optimizer.step()
- # Loss and accuracy for the complete epoch.
- epoch_loss = train_running_loss / counter
- epoch_acc = 100. * (train_running_correct / len(trainloader.dataset))
- return epoch_loss, epoch_acc
- # %%
- # Validation function.
- def validate(model, testloader, criterion, class_names):
- model.eval()
- print('Validation')
- valid_running_loss = 0.0
- valid_running_correct = 0
- counter = 0
- with torch.no_grad():
- for i, data in tqdm(enumerate(testloader), total=len(testloader)):
- counter += 1
- image, labels = data
- image = image.to(device)
- labels = labels.to(device)
- # Forward pass.
- outputs = model(image)
- # Calculate the loss.
- loss = criterion(outputs, labels)
- valid_running_loss += loss.item()
- # Calculate the accuracy.
- _, preds = torch.max(outputs.data, 1)
- valid_running_correct += (preds == labels).sum().item()
- # Loss and accuracy for the complete epoch.
- epoch_loss = valid_running_loss / counter
- epoch_acc = 100. * (valid_running_correct / len(testloader.dataset))
- return epoch_loss, epoch_acc
- # %%
- if __name__ == '__main__':
- # Load the training and validation datasets.
- dataset_train, dataset_valid, dataset_classes = get_datasets()
- print(f"[INFO]: Number of training images: {len(dataset_train)}")
- print(f"[INFO]: Number of validation images: {len(dataset_valid)}")
- print(f"[INFO]: Classes: {dataset_classes}")
- # Load the training and validation data loaders.
- train_loader, valid_loader = get_data_loaders(dataset_train, dataset_valid)
- # Learning_parameters.
- lr = args['learning_rate']
- epochs = args['epochs']
- device = ('cuda' if torch.cuda.is_available() else 'cpu')
- print(f"Computation device: {device}")
- print(f"Learning rate: {lr}")
- print(f"Epochs to train for: {epochs}\n")
- # Load the model.
- model = build_model(
- pretrained=True,
- fine_tune=True,
- num_classes=len(dataset_classes)
- ).to(device)
- # Total parameters and trainable parameters.
- total_params = sum(p.numel() for p in model.parameters())
- print(f"{total_params:,} total parameters.")
- total_trainable_params = sum(
- p.numel() for p in model.parameters() if p.requires_grad)
- print(f"{total_trainable_params:,} training parameters.")
- # Optimizer.
- optimizer = optim.SGD(model.parameters(), lr=lr, momentum=0.9)
- # Loss function.
- criterion = nn.CrossEntropyLoss()
- # Lists to keep track of losses and accuracies.
- train_loss, valid_loss = [], []
- train_acc, valid_acc = [], []
- # Start the training.
- for epoch in range(epochs):
- print(f"[INFO]: Epoch {epoch+1} of {epochs}")
- train_epoch_loss, train_epoch_acc = train(model, train_loader,
- optimizer, criterion)
- valid_epoch_loss, valid_epoch_acc = validate(model, valid_loader,
- criterion, dataset_classes)
- train_loss.append(train_epoch_loss)
- valid_loss.append(valid_epoch_loss)
- train_acc.append(train_epoch_acc)
- valid_acc.append(valid_epoch_acc)
- print(f"Training loss: {train_epoch_loss:.3f}, training acc: {train_epoch_acc:.3f}")
- print(f"Validation loss: {valid_epoch_loss:.3f}, validation acc: {valid_epoch_acc:.3f}")
- print('-'*50)
- time.sleep(2)
- # Save the trained model weights.
- save_model(epochs, model, optimizer, criterion)
- # Save the loss and accuracy plots.
- save_plots(train_acc, valid_acc, train_loss, valid_loss)
- print('TRAINING COMPLETE')
Training.ipynb at commit e1b599a, under BSD-3-Clause · at the source
Overview
- Department of Biomedical Engineering, University at Buffalo, Buffalo, New York 14260
- Department of Physiology, University at Buffalo, Buffalo, New York 14203
- Neuroscience Program, University at Buffalo, Buffalo, New York 14203
Abstract
Molecular tools available for rodent research enable detailed interrogation of the neural cell types and circuits that give rise to perception and decision-making during complex behaviors. To take full advantage of these molecular tools and successfully define causal relationships between neural function and overt actions during learning, there is a need for low-cost behavioral platforms with inherent flexibility in the implementation of task details. We present a behavioral platform capable of executing both head-fixed and freely moving task designs. The platform incorporates a user-interactive GUI that allows parameters to be adjusted online, during an acquisition session. Task metrics and performance indicators are acquired and organized into a standardized output, enabling single users to quickly master data analysis across a variety of task designs. To demonstrate the flexibility of the platform, mice of either sex were trained in two discrimination tasks: a head-fixed two-choice task as well as a freely moving operant conditioning task. Furthermore, we demonstrate that the platform can be used to show that mice harboring a mutation associated with autism spectrum disorder are able to perform a basic visual discrimination task in freely moving conditions. The presented work demonstrates the integration of multiple external devices to record task-related variables in a synchronized manner. As a result, the platform provides a valuable tool for affordable and reproducible investigation of behavioral decision-making as well as the neural basis underlying cognitive processes in health and disease.
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 5 matches between paragraphs and lines of code.
Mdcrespo/BehavioralPlatform
e1b599ae4ec52f03df315ab318b391f41333d6e2, 4 February 2026Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
21 files
- BehavioralTasks/
CirclesDiscrimination/ , MATLAB, 118 lines, 1 matchDataOut/ DataStructGenerator.m - BehavioralTasks/
CirclesDiscrimination/ , MATLAB, 1,074 lines, 1 matchTaskCode/ Circles_Discrimination_v GitHub.m - BehavioralTasks/
CirclesShaping_1/ , MATLAB, 118 linesDataOut/ DataStructGenerator.m - BehavioralTasks/
CirclesShaping_1/ , MATLAB, 1,060 linesTaskCode/ Circles_Shaping_1_vGitHu b.m - BehavioralTasks/
CirclesShaping_2/ , MATLAB, 118 linesDataOut/ DataStructGenerator.m - BehavioralTasks/
CirclesShaping_2/ , MATLAB, 1,065 linesTaskCode/ Circles_Shaping_2_vGitHu b.m - BehavioralTasks/
GratingDiscrimination2AC , MATLAB, 371 lines, 1 match/ DataOut/ dataStructGenerator.m - BehavioralTasks/
GratingDiscrimination2AC , MATLAB, 1,530 lines/ TaskCode/ grating_disc_2Choice_vGi tHub.m - BehavioralTasks/
RunningRewardAssociation , MATLAB, 72 lines2AC/ DataOut/ DataStructGenerator.m - BehavioralTasks/
RunningRewardAssociation , MATLAB, 1,046 lines2AC/ TaskCode/ Shaping_2Choice_vGitHub. m - PupilTracking/
ResNetModel/ , Jupyter, 110 linesnotebooks/ PredictionAsVideo.ipynb - PupilTracking/
ResNetModel/ , Jupyter, 193 lines, 1 matchnotebooks/ Predictions.ipynb - PupilTracking/
ResNetModel/ , Jupyter, 192 linesnotebooks/ Testing.ipynb - PupilTracking/
ResNetModel/ , Jupyter, 166 lines, 1 matchnotebooks/ Training.ipynb - PupilTracking/
ResNetModel/ , Jupyter, 56 linesnotebooks/ visualize_augmentations. ipynb - PupilTracking/
ResNetModel/ , Python, 71 linessrc/ findmydatasets.py - PupilTracking/
ResNetModel/ , Python, 25 linessrc/ model.py - PupilTracking/
ResNetModel/ , Python, 52 linessrc/ utils.py - PupilTracking/
eyeTracking_IRilluminati , MATLAB, 377 lineson_vGitHub.m - LICENSE, License, 28 lines
- README.md, Text, 1 line
Code accessibility
The code/
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;
- 19 scripts, each with its path and the digest of its content;
- 5 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.
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, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 6 keywords, 8 MeSH terms, 1 funder, 40 references.
Cite
This paper
Crespo, M. D., Vaillancourt, S. M., Goldstein, E. A., Broderick, M. R., Neske, G. T., & Kuhlman, S. J. (2026). Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice. eNeuro, 13(3), ENEURO.0459-25.2026. https://
BibTeX
@article{crespo2026open,
author = {Crespo, Michael D. and Vaillancourt, Sabrina M. and Goldstein, Elizabeth A. and Broderick, Maria R. and Neske, Garrett T. and Kuhlman, Sandra J.},
title = {{Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice}},
journal = {eNeuro},
year = {2026},
month = mar,
volume = {13},
number = {3},
pages = {ENEURO.0459--25.2026},
publisher = {Society for Neuroscience},
issn = {2373-2822},
doi = {10.1523/
url = {https://
pmid = {41735048},
pmcid = {PMC13045870}
}
RIS
TY - JOUR
AU - Crespo, Michael D.
AU - Vaillancourt, Sabrina M.
AU - Goldstein, Elizabeth A.
AU - Broderick, Maria R.
AU - Neske, Garrett T.
AU - Kuhlman, Sandra J.
TI - Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice
T2 - eNeuro
J2 - eNeuro
PY - 2026
DA - 2026/
VL - 13
IS - 3
SP - ENEURO.0459
EP - 25.2026
SN - 2373-2822
PB - Society for Neuroscience
DO - 10.1523/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1523/
"type": "article-journal",
"title": "Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice",
"container-title": "eNeuro",
"author": [
{
"family": "Crespo",
"given": "Michael D."
},
{
"family": "Vaillancourt",
"given": "Sabrina M."
},
{
"family": "Goldstein",
"given": "Elizabeth A."
},
{
"family": "Broderick",
"given": "Maria R."
},
{
"family": "Neske",
"given": "Garrett T."
},
{
"family": "Kuhlman",
"given": "Sandra J."
}
],
"container-title-short":
"volume": "13",
"issue": "3",
"page": "ENEURO.0459-25.2026",
"DOI": "10.1523/
"PMID": "41735048",
"PMCID": "PMC13045870",
"ISSN": "2373-2822",
"publisher": "Society for Neuroscience",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
13
]
]
}
}
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.105081 [code]
- Movie reconstruction from mouse visual cortex activity.Journal: eLifeIn common: OpenCV, Pillow, PyTorch, 2 other tools, optical imaging (calcium, voltage, 2-photon), mouse, 3 references
- [2] doi:10.7554/elife.109717 [code]
- Retrosplenial cortex enables context-dependent goal-directed sensorimotor transformation.Journal: eLifeIn common: OpenCV, Pillow, Statistics and Machine Learning Toolbox, 2 other tools, mouse, 2 references
- [3] doi:10.1111/ejn.70582 [code]
- Multifiber Array-Based Photometry System for Multiregional Functional Mapping in the Mouse Brain.Journal: The European journal of neuroscienceIn common: OpenCV, Pillow, Matplotlib, 1 other tool, optical imaging (calcium, voltage, 2-photon), mouse, 2 references
- [4] doi:10.1093/cercor/bhag047 [code]
- Association learning drives synaptic plasticity at feedforward synapses in somatosensory cortex.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: Matplotlib, NumPy, mouse, 4 references
- [5] doi:10.1038/s41597-025-05174-7 [code]
- A large-scale MEG and EEG dataset for object recognition in naturalistic scenesJournal: n/aIn common: Psychtoolbox, OpenCV, Pillow, 3 other tools
- [6] doi: [code]
- Real-time closed-loop feedback system for mouse mesoscale cortical signal and movement controlJournal: eLifeIn common: OpenCV, Pillow, Matplotlib, 1 other tool, optical imaging (calcium, voltage, 2-photon), mouse, 1 reference
- [7] doi:10.7554/elife.109313 [code]
- Linear and categorical coding units in the mouse gustatory cortex drive population dynamics and behavior in taste decision-making.Journal: eLifeIn common: PyTorch, Statistics and Machine Learning Toolbox, Matplotlib, 1 other tool, mouse, 2 references
- [8] doi:10.1126/sciadv.aef0343 [code]
- Learning induces activation-mechanism-dep
endent neural plasticity in an intracortical microstimulation task. Journal: Science advancesIn common: Pillow, Statistics and Machine Learning Toolbox, Matplotlib, 1 other tool, 2 references - [9] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: OpenCV, Pillow, PyTorch, 3 other tools, mouse
- [10] doi:10.1371/journal.pbio.3003915 [code]
- Noise-invariant representations of sound emerge along the canonical cortical hierarchy.Journal: PLoS biologyIn common: OpenCV, Pillow, PyTorch, 3 other tools, mouse
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, 19 scripts, and 5 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:0344ea613dde01ea…
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.
